Wednesday, February 14, 2024

Got a BMP280 pressure sensor working on the pico.

The example code from the adafruit library did not work. I had to hum and figure out to put in the following 2 lines to make it read: 

#define BMP_SCK  (5)

#define BMP_SDA  (4)

The first line was there, but had a different value, the second line was not in the example and didn't see it mentioned on any web site.  I just inferred that it was needed.  

I also had to specify the i2c hardware address.  The example I saw on line the guy was hard coding it in the library, and I didn't think that was right.  I put the address in as an argument on this line: 

status = bmp.begin(0x76);

Now I just need to convert meters into feet and pascals into inches of mercury. 😃 

BMP280 test

Temperature = 25.69 *C

Pressure = 99979.10 Pa

Approx altitude = 112.66 m


No comments:

Post a Comment