- Fri Nov 06, 2015 9:41 am
#33257
Something weird going on... tested by itself your little code snip , and aok added serialprintln and still ok
added to my code and it gives 0 instead of 3, on esp13 have not checked esp-12e
[SUBMIT.BRANCH] bottom 4 lines your code
results the last 2 zeros are from your code ---- currently puzzled !!!!!!!! I wonder if out of memory ???
--mycommand == eerfh25xx
--x = instr(mycommand, 'rfh') sb x = 2, x = 0
--z = x + 3 sb z = 5, z = 3.00
--w = x + 5 sb w = 7, w = 4.00
--y = mid(mycommand,z,w) sb 25, y = rfh2
0
3.00
4.00
--r = mid(mycommand,6,2) sb 25, r = 25
0
0
I've corrected my code now..... but still get 0,0 instead 3,3 see code
Code: Select allmycommand = " "
cnt = "1"
rfctr = 0
adc_id = 0
adc_value = 512
k1 = 0.11
p00 = 'P'
apc0 = 40000
ppm0 = 1770
adj1 = 1768
adj2 = 1769
cdeg0 = 25.1
fdeg0 = 77.18
kta0 = '0.01'
lo0 = '12'
hi0 = '20'
prb = '01.0'
ph = '7.0'
s0 = "000> 00001,00032 00342,65535 00700,66535 01000,34770 01400,65535"
bgc = 'Yellow'
B_Opn = 'http://i.imgur.com/kzt3tO8.png'
B_Clo = 'http://i.imgur.com/KS1dPa7.png'
Ipage = B_Clo
rfh = 15
wprint "<meta http-equiv='refresh' content="
wprint htmlvar(rfh)
wprint "rfh >"
wprint "<script type = 'text/javascript'>"
wprint "var timeInSecs;"
wprint "var ticker;function startTimer(secs){"
wprint "timeInSecs = parseInt(secs)-1;"
wprint "ticker = setInterval('tick()',1000);}"
wprint "function tick() {"
wprint "var secs = timeInSecs;"
wprint "if (secs>0) {timeInSecs--;} else {clearInterval(ticker);"
wprint "startTimer("
wprint htmlvar(rfh)
wprint ");}document.getElementById('countdown').innerHTML = secs;} startTimer("
wprint html(rfh)
wprint ");"
wprint "</script>"
wprint "<body><div>"
wprint "<table bgcolor='Lawngreen' border='1' cellpadding='5'>"
wprint "<th><h1>ESP8266 Blinker Thing!</h1></th>"
wprint "<td><IMG SRC ="
wprint htmlvar(Ipage)
wprint " LEFT='1' WIDTH='120' HEIGHT='60' BORDER='1'></td>"
wprint "<th id='countdown'>"
wprint htmlvar(rfh)
wprint "</th></table><br>"
wprint "<div><textarea name='cmd1s' cols='70' rows='14'>"
wprint htmlvar(s0)
wprint chr(13)
wprint "</textarea></div><br>"
wprint "<div><textarea name='cmd2s' cols='70' rows='6'>"
wprint htmlvar(s0)
wprint chr(10)
wprint "</textarea></div><br>"
wprint "<div><table bgcolor="
wprint htmlvar(bgc)
wprint " border='1' cellpadding='5'>"
wprint "<tr><th>Sensor</th><th>TempC</th><th>TempF</th><th>PPMcntr</th>"
wprint "<th>PPM__</th><th>Adj__1</th><th>Adj__2</th></tr>"
wprint "<tr><td>DS18B20P</td><td>"
wprint htmlvar(cdeg0)
wprint "</td><td>"
wprint htmlvar(fdeg0)
wprint "</td><td>"
wprint htmlvar(apc0)
wprint "</td><td>"
wprint htmlvar(ppm0)
wprint "</td><td>"
wprint htmlvar(adj1)
wprint "</td><td>"
wprint htmlvar(adj2)
wprint "</td></tr>"
wprint "<tr><th>Probe-K</th><th>Pool-PH</th><th>PH-Adj</th><th>ADC Value</th></tr>"
wprint "<tr><td>01.0</td><td>7.0</td><td>7</td><td bgcolor='Red'>"
wprint htmlvar(adc_value)
wprint "</td></tr></table></div><br>"
button "BLINK" [BLINK]
button "RD_ADC" [RDA.DC]
button "TEMP_DN" [TEMP.DN]
button "TEMP_UP" [TEMP.UP]
button "F_Deg" [Fdeg]
button "ForNxt" [ForNext]
WPRINT "<BR>CMD:"
textbox mycommand
button "SUBMIT" [SUBMIT.BRANCH]
wprint "<br>
wait
[BLINK]
if Ipage == B_Clo then Ipage = B_Opn else Ipage = B_Clo
wait
[RDA.DC]
AI adc_value
wait
[TEMP.DN]
SERIALPRINTLN "you clicked temp dn"
cdeg0 = cdeg0 - 0.1
fdeg0 = cdeg0 * 1.8
fdeg0 = fdeg0 + 32
ppm0 = ppm0 - 1
apc0 = apc0 - 1
adj1 = adj1 - 1
adj2 = adj2 - 1
wait
[TEMP.UP]
SERIALPRINTLN "you clicked temp up"
cdeg0 = cdeg0 + 0.1
fdeg0 = cdeg0 * 1.8
fdeg0 = fdeg0 + 32
ppm0 = ppm0 + 1
apc0 = apc0 + 1
adj1 = adj1 + 1
adj2 = adj2 + 1
wait
[Fdeg]
fdeg0 = cdeg0 * 1.8
fdeg0 = fdeg0 + 32
serialprintln fdeg0
wait
[ForNext]
for x = 1 to 5
if x = 1 then serialprintln "pass 1"
if x = 2 then serialprintln "pass 2"
if x = 3 then serialprintln "pass 3"
if x = 4 then serialprintln "pass 4"
if x = 5 then serialprintln "pass 5"
next x
wait
[SUBMIT.BRANCH]
if bgc == 'Yellow' then bgc = 'Cyan' else bgc = 'Yellow'
mycommand = "eerfh25xx"
x = instr(mycommand,"rfh")
serialprint "--mycommand == "
serialprintln mycommand
serialprint "--x = instr(mycommand, 'rfh') sb x = 3, x = "
serialprintln x
z = x + 3
serialprint "--z = x + 3 sb z = 6, z = "
serialprintln z
w = 2
y = mid(mycommand,z,w)
serialprint "--y = mid(mycommand,z,w) sb 25, y = "
serialprintln y
serialprintln x
serialprintln z
serialprintln w
r = mid(mycommand,6,2)
serialprint "--r = mid(mycommand,6,2) sb 25, r = "
serialprintln r
mycommand = "eerfh25xx"
x = instr(mycommand,"rfh")
print x
serialprintln x
wait
Last edited by xtal on Fri Nov 06, 2015 10:23 am, edited 2 times in total.