Shop OBEX P1 Docs P2 Docs Learn Events
jon williams ... Assistance please — Parallax Forums

jon williams ... Assistance please

bobsmithbobsmith Posts: 36
edited 2004-10-07 22:08 in BASIC Stamp
in this code that you said where in it does it say:

if in0 = 1

goto mode



Wait_For_2Sec:
· timer = 0

Check_Input:
· IF IN1 = 0 THEN Wait_For_2Sec
· timer = timer + 1
· PAUSE 50
· IF timer < 40 THEN Check_Input

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-07 22:08
    Didn't you want to force the button to be held for two seconds before Mode 1? If yes, then the Mode 1 code would come after that section. As soon as the timer reaches 40, the IF timer < 40 line will fail and the program will keep going.· Perhaps this will be more clear:

    Mode_0:···························· '·force button down for 2 seconds
    · timer = 0

    Check_Input:
    · IF IN1 = 0 THEN Mode_0
    · timer = timer + 1
    · PAUSE 50
    · IF timer < 40 THEN Check_Input

    Mode_1:
    · ' mode 1 code goes here

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office


    Post Edited (Jon Williams) : 10/7/2004 10:11:07 PM GMT
Sign In or Register to comment.