Autonomous-Analog Signals?

We are trying to get a potentiometer to turn on a motor when a potentiometer voltage is 4.8V. Our problem is the ANALOG CHANNEL_GET VOLTAGE VI only gets the voltage from the potentiometer once. We need it to keep reading the voltage until it reaches 4.8V.

Assuming this is in Autonomous, put a small loop around the Read Voltage and the compare.

You may also want to consider other conditions which would stop the loop and turn off the motor. In other words, is there a time limit that makes sense, or should the motor run no matter what until the switch is hit. You may also want a small delay in the loop – check every 10ms or so.

Greg McKaskle

Careful with the above suggestion. Using a while loop should work fine in autonomous but realize that you cannot reuse this code in teleop mode. You cant use these loops in teleop mode because while you are evaluating the loop, the cRIO isn’t updating any of the PWM ouputs. This will consequently cause a watchdog error. Instead there is a block under timing which evaluates a set time and outputs a boolean when it has elapsed and can be easily reset.

Hope this helps,

Thanks! I inserted while loops and now the autonomous code runs beautifully. I also ran the DS practice mode and had no problem (watchdog errors) transitioning from autonomous to teleop.

Thanks All!:slight_smile: