- This topic has 4 replies, 3 voices, and was last updated 7 years, 1 month ago by
Dave.
-
AuthorPosts
-
January 12, 2016 at 3:42 pm #3177
killerwhat
ParticipantHello, 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:
January 12, 2016 at 3:59 pm #3179winkleink
ParticipantFrom the code the wait commands are stopping everything so no input can be received.
Means A is only read every 3 secondsWhat 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.Attachments:
January 12, 2016 at 4:07 pm #3181killerwhat
ParticipantHi, 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.January 12, 2016 at 4:44 pm #3182winkleink
ParticipantOK, 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.Attachments:
October 20, 2016 at 6:43 pm #3928Dave
ParticipantThere isn’t a proper interrupt in the crumble language as far as I know
-
AuthorPosts
- You must be logged in to reply to this topic.