FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming the Minibot for FRC

Hello,

My team needs a little help in programming the minibot for this year's FRC Competition. The current program first waits for the touch sensor(port 2) to be touched, then the motors begin to turn, each going in separate directions (inward) sending the minibot up the pole. Once the minibot reaches the top of the pole, a piece is there to stop the minibot and another touch sensor(port 3) on the minibot waits to be to be touched, however, the wheels continue to go in the same direction as before.

This is a problem because after the second touch sensor is touched, the wheels are supposed to turn outward. I have made two separate configurations for the wheels going inward and the wheels going outward. The first configuration works fine, however, the second one does not. Despite me going in and changing the status of the 'reverse' command of the motors, they still run in the same direction as the first configuration, inward, when i want them to turn outward. I have attached screen shots what the first configuration looks like, the second configuration, and the actual program itself. Please help in anyway possible.

P.S. Don't mind the 'Manipulator' configuration.

Thank you

Vivian Stepp

0 Kudos
Message 1 of 3
(4,973 Views)

Hi Vivian,

After taking a quick look at your code, I don't believe that you need the While Loop. From your description, it seems that what you're trying to do is this:

example.png

What I believe was happening in your code is that when the second touch sensor was hit, it would just reiterate the While Loop and set the motors in a forward direction again and then wait for a touch again. Essentially, you were in an infinite loop because there was no exit strategy for exiting the While Loop. Since you are only waiting for the second touch sensor to be pressed once, you do not need it in a While Loop. I hope this helps! Feel free to post back if you have further questions.

Aaron P

NI FIRST Support

ni.com/FIRST

Message 2 of 3
(2,697 Views)

Thank you very much for your helpful response. The only problem that i have now is that the dc motors are not turning indefinitely until the sensor is touched, it only goes in one rotation. What way could i solve this problem?

Thank you,

Vivian

0 Kudos
Message 3 of 3
(2,697 Views)