I’m trying to get code that mixes if else statements and potentiometer positions.
hereit is:
#pragma config(Sensor, in1, Potentiometer, sensorPotentiometer)
#pragma config(Sensor, dgtl1, Green, sensorLEDtoVCC)
#pragma config(Sensor, dgtl12, yellow, sensorLEDtoVCC)
#pragma config(Motor, port2, one, tmotorVex393HighSpeed_MC29, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
task main()
{
while(1==1)
{
if(Potentiometer >= 0 && Potentiometer <= 800)
{
turnLEDOn(Green);
startMotor(port2, 126);
wait1Msec(2000);
stopMotor(port2);
turnLEDOff(Green);
}
else if(Potentiometer >= 1200 && Potentiometer <= 4000)
{
turnLEDOn(yellow);
startMotor(port2, -126);
wait1Msec(2000);
stopMotor(port2);
turnLEDOff(yellow);
}
else
{
stopMotor(port2);
}
}
}
am I doing something wrong because it is not working.