Simple and easy editable program for weather stations

Dependencies:   mbed mbed-STM32F103C8T6 thermistor HMC5883L DHT11 USBDevice

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "stm32f103c8t6.h"
00002 #include "mbed.h"
00003 #include "USBSerial.h"
00004 #include "thermistor.h"
00005 #include "HMC5883L.h"
00006 #include "DHT11.h"
00007 
00008 DigitalOut led(PC_13);
00009 Thermistor my_thermistor(ADC_TEMP, 10000, 3950, 4700);
00010 HMC5883L wind_direction(I2C_SDA, I2C_SCL);
00011 DHT11 temphum(PB_12);
00012 
00013 int main()
00014 {
00015     confSysClock();
00016     USBSerial usb(0x1f00, 0x2012, 0x0001,  false); //init usb serial
00017     
00018     usb.printf("\nReading temperature from internal sensor in processor\n");
00019     while(1) {
00020         temphum.readData();
00021         usb.printf("Thermistor = %f\n", my_thermistor.temperature());
00022         usb.printf("Heading = %f\n", wind_direction.getHeadingXYDeg());
00023         usb.printf("Temperature DHT11 = %d\n", temphum.readTemperature());
00024         usb.printf("Humidity DHT11 = %d\n", temphum.readHumidity());
00025         led = !led;
00026         wait(1.0);
00027     }
00028 }