I need something similar - but to get the weather forecast for the next 10 hours in Germany/Ramstein to run my heating (or even not), like seen on http://de.weather.com/stündlich/GMXX1141:1:GM
There are a lot of savings in spring and fall, when it’s cold in the morning but temperature is rising fast during the day.
I’m new to Arduino, but I did something like that already in MS Excel (Web Query + VBA), but I don’t want to run a notebook the whole year after debugging is done. Do you have some links for me to understand the basics behind ? German is ok (you are from Switzerland, right?). Many thanks in advance!
LOL! It’s supposed to let you know when a good time to catch the bus is. With buses coming to stops pretty frequently, and air horn does not seem appropriate to retain any level of sanity However, coming home and finding your living room covered in whipped cream would be pretty funny.
Welp, remember when I said “that is not what’s causing the 301 error” ? lmao… don’t listen to me I’m obviously not a web developer. After way too much head scratching, I figured it out. I looked up a bunch of people complaining about 301 redirect errors… and it appears that sometimes it’s related to mysite.com redirecting to www.mysite.com, but in my case that didn’t solve it. Most of the other reasons are due to the user actually putting in the wrong URL! Well it worked in my browser, so it must be right in my application.cpp right?? wrong! I changed the directory the index.php file was in to “bussstop” and in the application.cpp I had “busstop”… soooo, yeah. FAIL. Bright side is now I will never forget what 301 means.
But after that ego rebasing occurred, I still had an issue… I wasn’t getting any kind of a response. After analyzing the request so much in the first place, I had in the back of my mind that the request was taking 1200 milliseconds to complete. Looking at the code there was a hard delay of 1000ms before attempting to process the request.
So this code change should make it more dynamic… and currently I can say it’s not a good time to catch a bus from Bern to Bern,Inselspital.
//wait for request to be processed.
if(DEBUG) Serial1.println("waiting for response....");
If this hangs for more than 10 - 15 seconds the core will drop off the cloud and reconnect anyway currently, so I didn’t code in a 5 - 7 second timeout in the while() loop, but it would probably be a good idea as well.
@coffee Very good project!! I’m trying to modify a version for my son taking a bus every morning in Lugano.
I have troubles connecting to the server. If I try it manually I can have answer from the php script but with the firmware the program loop trying to connect. How can I check what is not working in my case?
Many thanks for every idea
This should give you a http response. if the http-response header is very long, the buffer on the spark might not be big enough. In my case, i have 5 lines of header, then two empty lines, then the answer starting with (–)
Thanks for the fast answer. As mentioned in my post the php script works fine and I receive the answer ( i.e. (–)red, (–)green etc. etc). I just tried the sketch on a Arduino Uno Ethernet and all is working fine!!
Only with the Spark Core I have problems connecting to the server
Now everything runs only the Core, no php script any more. And in the future I will add optional support for the Adafruit OLED 16x2 display. So you can use the LED and/or the display to show the next connections. (The display strings are ready, I just don’t have the display yet to try it).
I like this project very much. It is great :-), but if I try to compile follow error message appears, any idea?
In file included from …/inc/spark_wiring.h:30:0,
…/…/core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning “Defaulting to Release Build” [-Wcpp]
/bus-info_older_code.cpp:458:0: warning: “DEBUG” redefined [enabled by default]
In file included from …/inc/spark_wiring.h:32:0,
…/…/core-common-lib/SPARK_Firmware_Driver/inc/debug.h:77:0: note: this is the location of the previous definition
/bus-info_older_code.cpp:3:1: error: ‘Status’ does not name a type
/bus-info_older_code.cpp:4:16: error: variable or field ‘updateLED’ declared void
/bus-info_older_code.cpp:4:16: error: ‘Status’ was not declared in this scope
/bus-info_older_code.cpp:11:1: error: ‘Status’ does not name a type
make: *** [/bus-info_older_code.o] Error 1
Error: Could not compile. Please review your code.