mbed Weather Station for Weatherduino on mbeduino http://mbed.org/users/okini3939/notebook/weatherduino-on-mbed/
main.cpp
- Committer:
- okini3939
- Date:
- 2010-10-12
- Revision:
- 1:23400c328a71
- Parent:
- 0:6e444b317905
- Child:
- 2:920a4e65129d
File content as of revision 1:23400c328a71:
#include "mbed.h" #include "BMP085.h" #include "SHT.h" #include "WeatherMeters.h" I2C i2c(p9, p10); BMP085 bmp085(i2c, BMP085_oss4); SHT sht11(p24, p12, SHT_high); // sclock, data WeatherMeters wmeters(p30, p17, p21); // anemo, vane, rain DigitalOut myled(LED1); Serial pc(USBTX, USBRX); AnalogIn photo(p18); float get_photo (AnalogIn &ain) { float f; f = ain * 5.0 / 1000; // A return f / 0.0000026; } int main() { while(1) { myled = 1; bmp085.update(); pc.printf("p:%6.2f hPa / t:%6.2f C\n", bmp085.get_pressure(), bmp085.get_temperature()); sht11.update(SHT_high); pc.printf("t:%6.2f C / h:%6.2f %%\n", sht11.get_temperature(), sht11.get_humidity()); pc.printf("a:%6.2f m/s / v:%6.2f / r:%6.2f mm\n", wmeters.get_windspeed(), wmeters.get_windvane(), wmeters.get_raingauge()); pc.printf("l:%6.2f lux\n", get_photo(photo)); myled = 0; wait(10); } }