Add bme280 library

This commit is contained in:
maddiebaka
2026-04-26 10:39:53 -04:00
parent 55f927e62a
commit 103fa9e8a8
2 changed files with 45 additions and 3 deletions
+6 -3
View File
@@ -8,7 +8,10 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:miniatmega328]
[env:pro16MHzatmega328]
platform = atmelavr
board = miniatmega328
framework = arduino
board = pro16MHzatmega328
monitor_speed = 115200
lib_deps =
https://github.com/Sylaina/bme280.git
+39
View File
@@ -0,0 +1,39 @@
/**
* Copyright (C) PlatformIO <contact@platformio.org>
* See LICENSE for details.
*/
#include <avr/io.h>
#include <util/delay.h>
#include "bme280.h"
#include <stdio.h>
int main(void)
{
// make the LED pin an output for PORTB5
DDRB = 1 << 5;
float temp = 0.0;
float pressure = 0.0;
float humidity = 0.0;
bme280_init(0);
temp = bme280_readTemperature(0);
pressure = bme280_readPressure(0);
humidity = bme280_readHumidity(0);
while (1)
{
_delay_ms(1000);
printf("Temp: %f\tPressure: %f\tHumidity: %f\n", temp, pressure, humidity);
// toggle the LED
PORTB ^= 1 << 5;
}
return 0;
}