#pragma config(Sensor, dgtl1, button, sensorTouch)
#pragma config(Sensor, dgtl3, buttoff, sensorTouch)
#pragma config(Sensor, dgtl8, rws, sensorTouch)
#pragma config(Sensor, dgtl10, lws, sensorTouch)
#pragma config(Sensor, dgtl12, fws, sensorTouch)
#pragma config(Motor, port1, mr, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port10, ml, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/*
Robot name: meep
Task Description
Team Members: Alexander Sando & Aly Valdesuso
Date: 3/12/2020
Period: 4
*/
task main()
{
untilTouch(button); //when the on button is pressed:
startMotor(mr, 127); //start the right motor.
startMotor(ml, 127); //start the left motor.
while(true) //while true:
{
if(SensorValue(rws) == 1) //if the value of right wall sensor equals to on:
{
motor(ml) = 63; //set the left motor to half power.
wait(2); //run the left motor at half power for 2 secs.
motor(mr) = 63; //set the right motor to half power.
wait(2); //run the right motor at half power for 2 secs.
motor(mr) = 127; //set the right motor to full power.
motor(ml) = 127; //set the left motor to full power.
}
if(SensorValue(lws) == 1) //if the value of left wall sensor equals to on:
{
motor(mr) = 63; //set the right motor to half power.
wait(2); //run the right motor at half power for 2 secs.
motor(ml) = 63; //set the left motor to half power.
wait(2); //run the left motor at half power for 2 secs.
motor(mr) = 127; //set the right motor to full power.
motor(ml) = 127; //set the left motor to full power.
}
}
untilRotations(mr, 19); //until the right motor hit the 19th rotation:
stopMotor(mr); //stop the right motor.
stopMotor(ml); //stop the left motor.
}