I need help to make a toll booth for my class (pltw 2.0)

robot c btw

#pragma config(Sensor, in2, potentiometer, sensorPotentiometer)
#pragma config(Sensor, dgtl1, bumpy, sensorTouch)
#pragma config(Sensor, dgtl2, bumpy2, sensorTouch)
#pragma config(Motor, port2, motor, tmotorVex393_MC29, openLoop)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

task main()
{
untilTouch(dgtl11);
startMotor(port2, 63.5);
waitInMilliseconds(100);
stopMotor(port2);
untilTouch(dgtl12);
backward(63.5);
stopMotor(port2);

}

Basically I need it when I touch one button It moves the motor for 100 milliseconds stopping at the booth then when I touch the other button (theres two) it goes back to the default position. I just need to know what I did wrong since it only wants to go backwards then it does nothing please help.

I dont think your move backward command is right. It should be like the move forward command but with a negative value

1 Like

I can show you normal motor code, if you’d like. This is what it should technically look like, if it’s configured correctly in Motor/Sensor.

motor[port2] = 63;

wait1Msec(100);

motor[port2] = 0;
1 Like

thanks I think that will work,this was due today, I really appreciate it