Hello! I’m currently working on my team’s skills program. We align to walls multiple times in the program, and we use a limit switch so that when it’s pressed, we stop our drive motors and continue the program. However on occasion we hit the wall the wrong way, and are unable to complete the action. How can I make it time out after a time (say one second)? This is the original void
The brain has a built in timer, so I rest the timer, and just tell the motors to spin until either the button is pressed, or until a certain amount of time passes. I reset a timer before running the program, and that way, it is guaranteed that the function will end at at most 4 seconds. Tell me if you have any questions. You seemed to have the right idea, but you never actually counted up with the timepassed the first time.
We did some moves to align with the wall a couple times in our autonomous programs as well. The girls talked about adding a switch but it never got done. One thing we did experience is that we often got out of alignment or slightly climbed the wall when backing into it. Because of this, their exit from the wall sometimes was out of alignment. They found that this was minimized when the sequence of turning on and off motors was changed.
The girls had a 6 motor drive on a 4 wheel base, thus the code, for whatever reason, was written to turn on all 3 left motors, then all 3 right motors. When this happened, the robot would start one side SLIGHTLY before the other. Sometimes it worked good, sometimes it didn’t. The code was changed so that a left and right pair was turned on together and this seemed to help.
You could also turn on multiple motors with one command too - something like:
motor = motor = motorspeed;
(my apologies - I don’t have robotC in front of me right now, nor do I know if VCS can do the same thing)