Potentiometer & Auton


#1

I’m working on an auton for my team and the auton is suppose to start off with priming the catapult until it reaches the set position. I’m using the exact same code from my driver control and just copy/pasted it to the autonomous

(Catipult_Pot.value(analogUnits::range12bit) > 1400) {
Catipult.spin(directionType::rev, CatipultPCT, velocityUnits::pct);
}

but when I run the auton it completely skips over the line(s) and doesn’t prime the catapult at all. I’ve tried different options and they all have the same result, no primed shooter. Any help or recommendations would be greatly appreciated. Thank you!


#2

You’re missing a vital bit of code in this copy-paste. What comes immediately before this? If it’s an


if

keyword, it will check this once then keep moving. You would need a


while

keyword to make it do this until the pot reads less than 1400.


#3

I was able to fix it with the information you gave me! Thank you very much!