Current News

Moderator: Mmiscool

User avatar
By lew247
#51160 I'm using V3 Alpha 12 and I am VERY new to Basic (and programming)
I've read the manual and I understand a fair bit but I have a problem I cannot explain or fix

Can anyone tell me why I'm getting
Failed to reach end of input expression, likely malformed input

When I run the program, BUT the program runs anyway - ie this is the full output
Failed to reach end of input expression, likely malformed input
Date: Thu Jul 21 12:00:00 2016 T min 18.41 C T max 23.08 C 1.61 MPH 277 deg 1003.25 mB 66 % light rain 10d
Date: Fri Jul 22 12:00:00 2016 T min 17.07 C T max 20.11 C 1.85 MPH 74 deg 1006.67 mB 100 % moderate rain 10d
Date: Sat Jul 23 12:00:00 2016 T min 12.56 C T max 22.28 C 1.96 MPH 228 deg 1007.81 mB 83 % light rain 10d
Date: Sun Jul 24 12:00:00 2016 T min 12.34 C T max 20.84 C 2.59 MPH 269 deg 1008.18 mB 68 % scattered clouds 03d
Date: Mon Jul 25 12:00:00 2016 T min 16.08 C T max 22.74 C 2.81 MPH 311 deg 1016.73 mB 0 % light rain 10d
Date: Tue Jul 26 12:00:00 2016 T min 16.03 C T max 23.87 C 2.15 MPH 310 deg 1019.02 mB 0 % light rain 10d
Date: Wed Jul 27 12:00:00 2016 T min 17.64 C T max 25.7 C 2.35 MPH 169 deg 1017.66 mB 0 % light rain 10d
Done..


Also - can anyone point me to a way to call this program once or twice a day?
I want to run it but only "grab" the information once or twice a day

Here's the full code I'm using - hopefully someone can point me to my mistake

Code: Select alllet apid=“PUT ID HERE”
let query="api.openweathermap.org/data/2.5/forecast/daily?&units=metric&q=Haughton%20Green,uk&appid=" & appid
let ret = readopenweather(query,1)
let temp_min = json(ret,"temp.min")
let temp_max = json(ret,"temp.max")
let tim = json(ret,"dt")
let tim = unixtime(tim)
let speed = json(ret,"speed")
let dir = json(ret,"deg")
let pressure = json(ret,"pressure")
let humid = json(ret,"humidity")
let cloud = json(ret,"clouds")
let rain = json(ret,"description")
let icon = json(ret,"icon")
print "Date: "&tim&" T min "&temp_min&" C"&" T max "&temp_max&" C "&speed&" MPH "&dir&" deg "&pressure&" mB "&humid&" % "&rain&" "&icon
let ret = readopenweather(query,2)
let temp_min = json(ret,"temp.min")
let temp_max = json(ret,"temp.max")
let tim = json(ret,"dt")
let tim = unixtime(tim)
let speed = json(ret,"speed")
let dir = json(ret,"deg")
let pressure = json(ret,"pressure")
let humid = json(ret,"humidity")
let cloud = json(ret,"clouds")
let rain = json(ret,"description")
let icon = json(ret,"icon")
print "Date: "&tim&" T min "&temp_min&" C"&" T max "&temp_max&" C "&speed&" MPH "&dir&" deg "&pressure&" mB "&humid&" % "&rain&" "&icon
let ret = readopenweather(query,3)
let temp_min = json(ret,"temp.min")
let temp_max = json(ret,"temp.max")
let tim = json(ret,"dt")
let tim = unixtime(tim)
let speed = json(ret,"speed")
let dir = json(ret,"deg")
let pressure = json(ret,"pressure")
let humid = json(ret,"humidity")
let cloud = json(ret,"clouds")
let rain = json(ret,"description")
let icon = json(ret,"icon")
print "Date: "&tim&" T min "&temp_min&" C"&" T max "&temp_max&" C "&speed&" MPH "&dir&" deg "&pressure&" mB "&humid&" % "&rain&" "&icon
let ret = readopenweather(query,4)
let temp_min = json(ret,"temp.min")
let temp_max = json(ret,"temp.max")
let tim = json(ret,"dt")
let tim = unixtime(tim)
let speed = json(ret,"speed")
let dir = json(ret,"deg")
let pressure = json(ret,"pressure")
let humid = json(ret,"humidity")
let cloud = json(ret,"clouds")
let rain = json(ret,"description")
let icon = json(ret,"icon")
print "Date: "&tim&" T min "&temp_min&" C"&" T max "&temp_max&" C "&speed&" MPH "&dir&" deg "&pressure&" mB "&humid&" % "&rain&" "&icon
let ret = readopenweather(query,5)
let temp_min = json(ret,"temp.min")
let temp_max = json(ret,"temp.max")
let tim = json(ret,"dt")
let tim = unixtime(tim)
let speed = json(ret,"speed")
let dir = json(ret,"deg")
let pressure = json(ret,"pressure")
let humid = json(ret,"humidity")
let cloud = json(ret,"clouds")
let rain = json(ret,"description")
let icon = json(ret,"icon")
print "Date: "&tim&" T min "&temp_min&" C"&" T max "&temp_max&" C "&speed&" MPH "&dir&" deg "&pressure&" mB "&humid&" % "&rain&" "&icon
let ret = readopenweather(query,6)
let temp_min = json(ret,"temp.min")
let temp_max = json(ret,"temp.max")
let tim = json(ret,"dt")
let tim = unixtime(tim)
let speed = json(ret,"speed")
let dir = json(ret,"deg")
let pressure = json(ret,"pressure")
let humid = json(ret,"humidity")
let cloud = json(ret,"clouds")
let rain = json(ret,"description")
let icon = json(ret,"icon")
print "Date: "&tim&" T min "&temp_min&" C"&" T max "&temp_max&" C "&speed&" MPH "&dir&" deg "&pressure&" mB "&humid&" % "&rain&" "&icon
let ret = readopenweather(query,7)
let temp_min = json(ret,"temp.min")
let temp_max = json(ret,"temp.max")
let tim = json(ret,"dt")
let tim = unixtime(tim)
let speed = json(ret,"speed")
let dir = json(ret,"deg")
let pressure = json(ret,"pressure")
let humid = json(ret,"humidity")
let cloud = json(ret,"clouds")
let rain = json(ret,"description")
let icon = json(ret,"icon")
print "Date: "&tim&" T min "&temp_min&" C"&" T max "&temp_max&" C "&speed&" MPH "&dir&" deg "&pressure&" mB "&humid&" % "&rain&" "&icon
User avatar
By Oldbod
#51163 I can't tell you why you're getting the error, sorry. Too much there for me to go through, and like you I'm new to esp8266basic, plus would need to read all the documentation and try it and no time atm. But wrong type of quotes, missing spaces or changes in command structures with version changes are things that can trip you up. There are debugging aids on the way I think, but meanwhile the other useful thing is just to try to create a small subset of your code to try to localise the error. When you write it, ask yourself what you would most like to see if it goes wrong and stick that in a variable perhaps...

Sleep may be a good command for timing. To my mind what's best really depends on what your objective is - power saving or whaever... good luck
User avatar
By forlotto
#51229 Note the lines that look like this they may need spaces between things as this used to be normal so they should look like this to be on the safe side.

Code: Select allprint "Date: " & tim & " T min " & temp_min & " C" & " T max " & temp_max & " C " & speed & " MPH " & dir & " deg " & pressure & " mB " & humid & " % " & rain& " " & icon


This also used to be the correct format for your last line of code. Hope this helps. Spaces Spaces Spaces ...

The other thing is your first two lines are both missing spaces by the equals signs 1 before 1 after is usually the rule that I have followed.

Hope this does the trick.

let apid=“PUT ID HERE”
let query="api.openweathermap.org/data/2.5/forecast/daily?&units=metric&q=Haughton%20Green,uk&appid=" & appid

Should be:

let apid = “PUT ID HERE”
let query = "api.openweathermap.org/data/2.5/forecast/daily?&units=metric&q=Haughton%20Green,uk&appid=" & appid