Tell me what you want, What you really, really want.

Moderator: Mmiscool

User avatar
By jimg
#63211 None of my posts have shown up yet, so I can't just fix them.

Anyway, looking more closely at the new help file, I see that in the example, timer 0 was used rather than timercb 0.
Code: Select allExample:

Print “timer example”

Timercb 1000, [test]

Wait

[test]

If io(pi,d3) = 0 then

   Timer 0

   serialPrintln “timer has been disabled”

Else

   serialPrintln “Button connected to d3 (gpio 0) is high”

Endif

return


If that was the actual code used to test the timer, it gave a false sense of correctness, as timer 0 does not stop the timer set up with timercb, and "timercb 0" was not tested.
User avatar
By Mmiscool
#63317 I just fixed the docs.

It should have been timercb 0 to cancel the timer from running.
User avatar
By jimg
#63336 okay, but it still doesn't work for me.
I'm using 3.0 alpha 67, the lastest one I found.

try this program
Code: Select allmemclear
cls
button "Quit",[endprog]
timercb 1000,[endtest]  'run for a second
timercb 0

wait
[endtest]
wprint "<br>timer triggered"
return

[endprog]
end


I get the error-
Error at line 5: timercb line not found!
User avatar
By Mmiscool
#63344 Ok.

I just published a new build fixing this issue.

It seems that the timercb 0 condition qwas not caught by the interpreter and it was attempting to find the mine number of the branch.

This has now been fixed.