FIRST Tech Challenge Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Double Limit Switch Problem, need help

Hello, we need help with our programming. We want to limit the movement of a tetrix motor to stop when a "touch sensor" is pressed. We have programmed according to what we think is correct. But the program runs choppy, like buffering or stalling.

We want to put a second limit swith for the same motor so it will limit the movement when going "reverse". Our question is do we have to create 2 separate cases outside the BUTTON loop for each PORT, or can we just use an OR for PORT3 or PORT4?

Thanks for any help.

Screen Shot 2014-11-20 at 10.00.06 PM.png

0 Kudos
Message 1 of 2
(4,478 Views)

Hello 9419,

Your program looks pretty good to me. I don't think you want to be feeding the watchdog timer every iteration of the loop.

You should probably try to feed the watchdog timer about once every two seconds. You can do this by setting up a loop in parallel with the main loop which just feeds the watchdog.

watchdog.PNG

Message 2 of 2
(3,842 Views)