mbed Weather Platform firmware http://mbed.org/users/okini3939/notebook/mbed-weather-platform-firmware/
Dependencies: EthernetNetIf SDHCFileSystem I2CLEDDisp Agentbed NTPClient_NetServices mbed BMP085 HTTPClient ConfigFile I2CLCD
Diff: main.cpp
- Revision:
- 8:bab92fb7ef97
- Parent:
- 7:0d3484dc13a9
- Child:
- 9:8c63e4f3edab
--- a/main.cpp Thu Jan 13 12:35:51 2011 +0000 +++ b/main.cpp Wed Jan 26 16:28:52 2011 +0000 @@ -44,9 +44,11 @@ WeatherMeters wmeters(p21, p15, p22); // anemo, vane, rain AnalogIn ailight(p16), aimoist(p18), aiuv(p17); +DigitalOut swout1(p29), swout2(p30); +Ticker ticker; + #ifdef USE_I2CLEDDISP I2CLEDDisp leddisp(i2c); -Ticker ticker; int ledpos, ledflg; char ledbuf[100]; #endif @@ -94,8 +96,8 @@ return f; } +void ledscroll () { #ifdef USE_I2CLEDDISP -void ledscroll () { int i, addr, len; len = strlen(ledbuf); @@ -112,14 +114,26 @@ if (ledpos >= len + 4) { ledpos = -4; } -} #endif + locUpTime = locUpTime + 40; // 0.4s +} + void action (char *buf) { + if (check_action('h')) { + swout1 = 1; + led4 = 1; + } + if (check_action('l')) { + swout1 = 0; + led4 = 0; + } if (check_action('H')) { + swout2 = 1; led4 = 1; } if (check_action('L')) { + swout2 = 0; led4 = 0; } if (check_action('P')) { @@ -233,13 +247,15 @@ time_t sec; char buf[100]; + swout1 = 0; + swout2 = 0; led1 = 1; #ifdef USE_I2CLEDDISP ledflg = 0; ledpos = -4; strcpy(ledbuf, VERSION); +#endif ticker.attach(&ledscroll, 0.4); -#endif init(); pc.printf(VERSION "\r\n\r\n"); @@ -322,6 +338,5 @@ Net::poll(); } timer.reset(); - locUpTime = locUpTime + (conf.interval * 100); } }