I’ve been using a pair of line sensors to detect when balls have reached certain points for our intake and launcher. They have been relatively successful in driver control, but once I attempted to use them in auton they started behaving strangely. The logic I used in driver to associate a threshold in relation to what the sensors were reading no longer worked. I started a new program, and just printed the numbers that the sensors were reading to the brain screen. However, once I attempted to use those numbers in a logic statement they no longer contained a value (or at least I’m assuming so, the values still printed as expected but the logic statement did not respond to those variables). I’ll post the code below:
void autonomous( void ) {
while(true) //extended loop for testing
{
Intake.spin(directionType::fwd, 25, velocityUnits::pct); //turn on intake at slow speed to show no ball
while(puncherSense.value(vex::percentUnits::pct) > 45) //is being picked up
{
vex::task::sleep(20); //release resources
}
Intake.stop();
vex::task::sleep(20); //release resources
}
}