Could some look at this FOR NEXT Routine and tell me if this the right way to d
This seem to work the way that i want it to work but is this the right way to this
run:
DO··················
HIGH led·············
LOW chg··············
PAUSE dly1
··········
'charge·············
LOW led··············
HIGH chg
PAUSE dly1
'input
LOW led
INPUT chg
PAUSE dly2············
DEBUG CR, DEC ? chg
GOSUB Get_Time
·DEBUG HOME, HEX2 mins, ":", HEX2 secs, CR
·IF secs = $59 THEN
PAUSE 1000
·ENDIF
IF chg = 0 THEN········
· PAUSE dly3
ELSE
· IF chg = 1 THEN········ ······················· '·I want to run so many times to see if it still true if so then do something
· FOR idx = 1 TO 300···························· ·' This seem to work but is this the right way to do this
· DEBUG DEC5 ? idx , DEC5 ? leaps
From here down i want to run so many time if this statement stays true· IF leaps = 300 AND chg = 1 THEN EXIT·····
____________________________________________________________________________________________________
· HIGH led·············
LOW chg··············
PAUSE dly1
··········
'charge··············
LOW led··············
HIGH chg
PAUSE dly1
'input
LOW led
INPUT chg
PAUSE dly2············
DEBUG CR, DEC ? chg
leaps = leaps + 1
NEXT
·idx = idx + 1
ENDIF
· ENDIF
· IF leaps = 300 AND chg = 1 THEN EXIT·····
LOOP
_________________________________________________________________________________________________
DO
HIGH 14
PAUSE 100
LOW 14
PAUSE 100
LOOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·that you may have and all of your time finding them
·
·
·
·
Sam
run:
DO··················
HIGH led·············
LOW chg··············
PAUSE dly1
··········
'charge·············
LOW led··············
HIGH chg
PAUSE dly1
'input
LOW led
INPUT chg
PAUSE dly2············
DEBUG CR, DEC ? chg
GOSUB Get_Time
·DEBUG HOME, HEX2 mins, ":", HEX2 secs, CR
·IF secs = $59 THEN
PAUSE 1000
·ENDIF
IF chg = 0 THEN········
· PAUSE dly3
ELSE
· IF chg = 1 THEN········ ······················· '·I want to run so many times to see if it still true if so then do something
· FOR idx = 1 TO 300···························· ·' This seem to work but is this the right way to do this
· DEBUG DEC5 ? idx , DEC5 ? leaps
From here down i want to run so many time if this statement stays true· IF leaps = 300 AND chg = 1 THEN EXIT·····
____________________________________________________________________________________________________
· HIGH led·············
LOW chg··············
PAUSE dly1
··········
'charge··············
LOW led··············
HIGH chg
PAUSE dly1
'input
LOW led
INPUT chg
PAUSE dly2············
DEBUG CR, DEC ? chg
leaps = leaps + 1
NEXT
·idx = idx + 1
ENDIF
· ENDIF
· IF leaps = 300 AND chg = 1 THEN EXIT·····
LOOP
_________________________________________________________________________________________________
DO
HIGH 14
PAUSE 100
LOW 14
PAUSE 100
LOOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·

·
·
·
·
Sam
Comments
Without a very specific question, it's impossible to tell you if this is a better solution than some other.
thank you for your reply
The rountine that i have here i only want to do something if the statement stay true for so long
I want to run through this routine 300 time to see if it stays true
IF leaps = 300 AND chg = 1 THEN EXIT
·DO··················
HIGH led·············
LOW chg··············
PAUSE dly1
··········
'charge·············
LOW led··············
HIGH chg
PAUSE dly1
'input
LOW led
INPUT chg
PAUSE dly2············
DEBUG CR, DEC ? chg
· PAUSE dly3
leaps = leaps + 1
LOOP
··
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Look at the PBASIC Help file for LOOP UNTIL.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Programming can't be all that difficult, it's nothing but 1's and 0's
Thanks for you reply
·This is what i try ed first was·LOOP UNTIL but as soon as· the statement was true it jump to the next stament which is not what i am wanting
What i want is to loop so many time to see if it stay true then jump to the next statement
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam