Code written by Paul Rabbat, Angel Daruna, Jarel Hawkins, and Cordel Williams
Dependencies: 4DGL-uLCD-SE EthernetInterface HTTPClient NTPClient PinDetect SDFileSystem mbed-rpc mbed-rtos mbed wave_player
Fork of ECE4180_FinalProject by
Diff: main.cpp
- Revision:
- 5:be2cfaa8f4a2
- Parent:
- 4:bb1bb1fc0cf5
- Child:
- 6:24d42cae48ad
--- a/main.cpp Mon Dec 01 18:19:21 2014 +0000 +++ b/main.cpp Mon Dec 01 18:35:32 2014 +0000 @@ -62,6 +62,8 @@ #include "spxmlhandle.hpp" void getWeather(); void getTime(); +void parseResults(); +char buf[3000]; int main() { dim = -1.0; @@ -96,6 +98,8 @@ getWeather(); wait(1); + parseResults(); + wait(1); getTime(); wait(1); @@ -105,9 +109,8 @@ zerocross.rise(&dimmer); // main program only sets dimmer level (dim) // interrupt routines dim the light - - //Thread t1(thread_server); //start thread_server + Thread t1(thread_server); //start thread_server Thread t2(thread_display); Thread t3(thread_alarm); @@ -119,10 +122,8 @@ void getWeather(){ /*** WEATHER****/ - char buf[3000]; printf("Getting weather..\n"); HTTPClient http; - SP_XmlDomParser parser; int retHttp = http.get("http://weather.yahooapis.com/forecastrss?w=28426187&u=c", buf, sizeof(buf)); switch(retHttp){ @@ -138,13 +139,16 @@ default: printf("Error\n"); } +} +void parseResults(){ + printf("Starting parser\n"); + SP_XmlDomParser parser; + printf("\n----------%s----------\n",buf); wait(5.0); printf("Appending to parser..\n"); - - /** FREEZING HERE **/ parser.append( buf, strlen(buf)); // stream current buffer data to the XML parser wait(5.0); printf("Parser appended\n"); @@ -181,7 +185,7 @@ printf("Temp:Low%sC High%sC\n",forecast->getAttrValue("low"),forecast->getAttrValue("high")); } - printf("Weather complete!!!!!\n"); + printf("Parser complete!\n"); } void getTime(){