{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360 {\fonttbl\f0\fmodern\fcharset0 Courier;} {\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww15680\viewh10280\viewkind0 \deftab720 \pard\pardeftab720\ql\qnatural \f0\fs24 \cf0 \ \ \ \ #pragma config(Sensor, dgtl1, front, sensorTouch)\ #pragma config(Motor, port2, rightMotor, tmotorServoContinuousRotation, openLoop, reversed)\ #pragma config(Motor, port3, leftMotor, tmotorServoContinuousRotation, openLoop)\ //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//\ \ /*----------------------------------------------------------------------------------------------------*\\\ |* - Moving Forward - *|\ |* ROBOTC on VEX 2.0 CORTEX *|\ |* *|\ |* This program instructs your robot to move forward at full power for three seconds. There is a *|\ |* two second pause at the beginning of the program. *|\ |* *|\ |* ROBOT CONFIGURATION *|\ |* NOTES: *|\ |* 1) Reversing 'rightMotor' (port 2) in the "Motors and Sensors Setup" is needed with the *|\ |* "Squarebot" mode, but may not be needed for all robot configurations. *|\ |* 2) Power levels that can be assigned to a motor port range from -127 (full reverse) to *|\ |* 127 (full forward). *|\ |* *|\ |* MOTORS & SENSORS: *|\ |* [I/O Port] [Name] [Type] [Description] *|\ |* Motor Port 2 rightMotor VEX 3-wire module Right side motor *|\ |* Motor Port 3 leftMotor VEX 3-wire module Left side motor *|\ \\*-----------------------------------------------------------------------------------------------4246-*/\ \ \ //+++++++++++++++++++++++++++++++++++++++++++++| MAIN |+++++++++++++++++++++++++++++++++++++++++++++++\ task main()\ \{\ while(1 == 1)\{ //loops forever\ \ if (SensorValue[front] == 1)\{ //if the bumper on the front is HIGH\ motor[rightMotor] = 0;\ motor[leftMotor] = 0;\ wait1Msec(100);\ motor[rightMotor] = +30;\ motor[leftMotor] = +30;\ wait1Msec(1000);\ motor[rightMotor] = +50;\ motor[leftMotor] = -50;\ wait1Msec(3250);\ \}\ if (SensorValue[front] == 0)\{ //if the bumper on the front is LOW\ motor[rightMotor] = -30;\ motor[leftMotor] = -30;\ \}\ \}\ \}\ }