Home 2018 Forums Crumble Support Interrupt?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3177
    killerwhat
    Participant

    Hello, me again!
    How do I use an input to interrupt a running loop instantly? Trying to program a simple bump-n-reverse function using if-then-else but it takes too long to react 🙁
    Help please !

    Attachments:
    #3179
    winkleink
    Participant

    From the code the wait commands are stopping everything so no input can be received.
    Means A is only read every 3 seconds

    What are you trying to do?

    I’ve attached code for the robot to go forward and if A is high to reverse a little and turn.

    The default is go forward
    Only the A High test is in the Forever loop.

    #3181
    killerwhat
    Participant

    Hi, thanks for the quick reply.
    I was trying for a program that controls a continuous go-turn-go-turn-go etc but would respond if it bumped into an obstacle by backing away, turning and then carrying on as before.

    #3182
    winkleink
    Participant

    OK, see revised attached code
    If you use this instead of the Wait in the Else part of your code then it will allow the button to be read even during the Wait.

    It counts to a 100 and waits 20ms each time. Totaling 2000ms or 2 seconds.
    Revised accordingly for the 1s Wait.

    #3928
    Dave
    Participant

    There isn’t a proper interrupt in the crumble language as far as I know

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.