diff --git a/platformio.ini b/platformio.ini index 0079ee8..f90deed 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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 + diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..fcb82ce --- /dev/null +++ b/src/main.c @@ -0,0 +1,39 @@ +/** + * Copyright (C) PlatformIO + * See LICENSE for details. + */ + +#include +#include + +#include "bme280.h" +#include + +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; +}