Simple and easy editable program for weather stations
Dependencies: mbed mbed-STM32F103C8T6 thermistor HMC5883L DHT11 USBDevice
Diff: main.cpp
- Revision:
- 0:eb7b33d1b081
- Child:
- 1:f2402d1acb80
diff -r 000000000000 -r eb7b33d1b081 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun May 17 18:10:48 2020 +0000 @@ -0,0 +1,28 @@ +#include "stm32f103c8t6.h" +#include "mbed.h" +#include "USBSerial.h" +#include "thermistor.h" +#include "HMC5883L.h" + #include "Dht11.h" + +DigitalOut led(PC_13); +Thermistor my_thermistor(ADC_TEMP, 10000, 3950, 4700); +HMC5883L wind_direction(I2C_SDA, I2C_SCL); +Dht11 temphum(PB_13); + +int main() +{ + confSysClock(); + USBSerial usb(0x1f00, 0x2012, 0x0001, false); //init usb serial + + usb.printf("\nReading temperature from internal sensor in processor\n"); + while(1) { + sensor.read() + usb.printf("Thermistor = %f\n", my_thermistor.temperature()); + usb.printf("Heading = %f\n", wind_direction.getHeadingXYDeg()); + usb.printf("Temperature DHT11 = %f\n", temphum.getCelsius()); + usb.printf("Humidity DHT11 = %f\n", temphum.getHumidity()); + led = !led; + wait(1.0); + } +}