After completing the LED blinker, the “Hello world” for micro controller projects, the next thing is just going straight to the barometer sensor.
I first need to get the driver for BMP280 from Adafruit. The page has the list of compatible MCUs tested by them. This doesn’t include ESP32C3 so I thought the road ahead could be rough.
I downloaded the repository with a zip file, unzipped it and then opened one of the example code “bmp280test.ino” from the IDE. I compiled it and had an error saying it’s missing a header file “Adafruit_BMP280.h” which resides in a different directory. I didn’t know how to add multiple source code to the project.
While trying to find the solution, I found “Add .ZIP library” menu under “Include Library”. I then thought maybe I could just add the repository .zip file to the project. As expected, it worked!
I then had another error saying it misses I2C driver files from Adafruit. I soon found the driver’s repository, added the zip file to the project. Had another missing file, repeated the same process and then I could build the project. In total, I had to add three libraries from Adafruit as below. Anyway, adding a zip file as a library was very easy and straightforward.

I then connected the BMP280 board with the controller using I2C. Run the code and then immediately found the temperature and air pressure values in the terminal!


I expected I could struggle with I2C connection or sensor settings but there was nothing wrong. It just worked.