working weather

Dependencies:   4DGL-uLCD-SE NetServices mbed spxml

Fork of weather_Nokia_LCD_display_yahoo by Layton Balliet

Files at this revision

API Documentation at this revision

Comitter:
ashea6
Date:
Mon Apr 25 16:22:39 2016 +0000
Parent:
1:c96f140b5710
Commit message:
random letters

Changed in this revision

4DGL-uLCD-SE.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r c96f140b5710 -r b14f99568253 4DGL-uLCD-SE.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/4DGL-uLCD-SE.lib	Mon Apr 25 16:22:39 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/sparkfun/code/4DGL-uLCD-SE/#e39a44de229a
diff -r c96f140b5710 -r b14f99568253 main.cpp
--- a/main.cpp	Thu Mar 07 21:16:40 2013 +0000
+++ b/main.cpp	Mon Apr 25 16:22:39 2016 +0000
@@ -4,14 +4,16 @@
 #include "spdomparser.hpp"
 #include "spxmlnode.hpp"
 #include "spxmlhandle.hpp"
-#include "NokiaLCD.h"
+//#include "NokiaLCD.h"
+#include "uLCD_4DGL.h"
 #include <string>
 // Internet of Things weather display example: LCD displays LA current weather via internet Google API
 // Adapted for LCD from http://mbed.org/users/hlipka/programs/spxmltest_weather/lif782
 
-NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type
-DigitalIn but1(p13);
-DigitalIn but2(p14);
+//NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type
+uLCD_4DGL lcd(p28,p27,p29);
+DigitalIn but1(p19);
+DigitalIn but2(p20);
 EthernetNetIf eth;
 HTTPClient http;
 HTTPResult result;
@@ -83,7 +85,7 @@
     lcd.locate(0,2);
     lcd.printf("net setup");
     lcd.locate(0,3);
-    EthernetErr ethErr = eth.setup();
+    EthernetErr ethErr = eth.setup(60000);
     if (ethErr) {
         lcd.printf("Error in setup");
         return -1;
@@ -96,7 +98,7 @@
     char BigBuf[512 + 1] = {0};
     stream.readNext((byte*)BigBuf, 512); //Point to buffer for the first read
     //Yahoo! weather API for selected city - get XML document for parsing
-    HTTPResult r = http.get(head.c_str(), &stream, request_callback);
+    HTTPResult r = http.get("https://query.yahooapis.com/v1/public/yql?q=select%20item.condition%20from%20weather.forecast%20where%20woeid%20in%20%28select%20woeid%20from%20geo.places%281%29%20where%20text%3D%22atlanta%2C%20ga%22%29&amp", &stream, request_callback);
     while (!completed) {
         Net::poll(); //Polls the Networking stack
         if (stream.readable()) {
@@ -117,6 +119,9 @@
     SP_XmlHandle rootHandle( parser.getDocument()->getRootElement() );
     SP_XmlElementNode * child2 = rootHandle.getChild( "channel" )
                                  .toElement();
+    
+    lcd.printf(BigBuf);
+    
     if ( child2 ) {
         parseWeather(child2, cities[curr]); //parses XML "current-conditions" info
     }