I'm having a problem with running some code on an Esp8266-01. The code checks my thingspeak account, extracts the required value then flashes an LED the respective number of times.
After some time has passed, I am faced with program stopping and the following error:
Comparaison between string and number! BUFFER TOO BIG! PROGRAM STOPPED
The question I am posing is this: I know that I can convert number to string using str(), but I can't seem to convert the extracted value back from string to integer, hence the aforementioned error.
Here's my code, as you will see I have tried several 'messy' workarounds, with liberal helpings of memclear and cls (I'm still a noob, no matter how long I study ) The joy is in the journey and the final 'AH HA !' moment when it does what i planned.
Anyway, please give me some guidance, I'm reaching 'the wall' .
b = 0
Do
b = b+1
print b
cls 'clears the screen buffer to prevent stalling
print "*****Hello Neil***********"
print id()
print "Local IP is: " & ip()
print "Date is: " & time("day / month / year...hour:min:sec")
print "****************"
delay 1000
po 0 0
print "Sending Text Alert via IFTTT"
print 'wget("maker.ifttt.com/trigger/front_door/with/key/bb3qCP9**********M-pr0")
po 0 1
delay 1800
po 2 0
print "****************"
print "sending colour request to thingspeak"
g = str(90636) 'channel
w = str(2) 'field
x = readts("8NFEQ**********N",g,w) 'allows the reading to be used as a variable
print "Latest colour request is: " & x
print "****************"
print "sending temperature request to thingspeak"
g = str(90636) 'channel
w = str(1) 'field
t = readts("8NFEQ**********N",g,w)
print "Latest temperature reading is: " & t
delay 1000
'''''''''''''''''''''''
n = x
print n
o = 0
cls
if n == o then goto [fin]
cls
'''''''''''''''''''''''
memclear
po 0 0
delay 1000
led = 0
Do 'flashes blue led, gpio2, according to value of n
led = led + 1
po 2 1
delay 500
po 2 0
delay 500
loop until led = n
cls
po 2 0
cls
[fin]
delay 10000
po 0 1
cls
sleep 120000
delay 10000
Loop until b = 7
po 2 0
po 0 0
cls
sleep 120000
reboot
?? Any help or guidance greatly appreciated ??