And since here is PBP forum, not general representation forum, I'm asking how to deal with this in PBP![]()
And since here is PBP forum, not general representation forum, I'm asking how to deal with this in PBP![]()
Will this work for you?
iflag var bit
let iflag =0
reader:
adcin 0,Z
pause 100
IF Z>100 AND Z<130 THEN I=I+5
IF Z<100 and iflag = 0 THEN I=I-5 'only if iflag = 0 it's OK to substract
if i>255 then i=255
if i<5 then i=0
if i = 0 then let iflag = 1 'if i hits 0 put up a flag
if i >= 5 then let iflag = 0 'once i hits 5 or more, reset the flag
HPWM 2,I,10000
XY=I
gosub decoder
goto reader
Try this:
if Z.15 = 1 then
Z = 0
endif
Last edited by Dick Ivers; - 22nd June 2020 at 21:09.
In your original code, changeto thisCode:IF Z<100 THEN I=I-5Code:IF Z<100 AND I>=5 THEN I=I-5
Bookmarks