-->
Page 1 of 2

for next loop acting wierd

PostPosted: Mon Nov 16, 2015 9:50 am
by viscomjim
Hi Mike, doing this...

for x = 1 to 100
po 2 0
delay 200
po 2 1
delay 200
next x

I am getting very weird timing instead of a normal flash with 200ms delays between on and off. The led stays on (po 2 0) much longer than led off (po 2 1).

Should I be doing this a different way?

this is on an nodemcu esp8266 12e board with basic 1.41

EDIT...

Doing this...

for x = 1 to 10
serialprintln x
next x

The output looks like this...

1
2.00
3.00
etc. to
10.00

As you can see the first iteration is good and get 1. After that the output always has 2 decimal places added. Can this be an option so that it doesn't add decimal places unless asked to?

Thanks again for your efforts. This is getting really cool.

Re: for next loop acting wierd

PostPosted: Tue Nov 17, 2015 8:19 pm
by viscomjim
I must be the only one experiencing this. I will try another way maybe using x = x + 1 to see if that works better.

Re: for next loop acting wierd

PostPosted: Tue Nov 17, 2015 9:41 pm
by Mmiscool
Speed of the interpreter is a known problem.

As to the for next loop speed I just made a few tweaks that should make it work much better.

Download the latest version. v1.45

Very precise timing is not possible with the current architecture.

Re: for next loop acting wierd

PostPosted: Tue Nov 17, 2015 9:55 pm
by viscomjim
Thanks Mike for the reply. I will try the new code shortly. Any news or ideas about the 2 decimal places after the first iteration of the for next loop?