Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma config(Sensor, in1, lineFollower, sensorLineFollower)
- #pragma config(Sensor, in2, potentiometer, sensorPotentiometer)
- #pragma config(Sensor, in3, lightSensor, sensorReflection)
- #pragma config(Sensor, dgtl1, limitSwitch, sensorTouch)
- #pragma config(Sensor, dgtl2, bumpSwitch, sensorTouch)
- #pragma config(Sensor, dgtl3, quad, sensorQuadEncoder)
- #pragma config(Sensor, dgtl5, sonar, sensorSONAR_cm)
- #pragma config(Sensor, dgtl12, green, sensorLEDtoVCC)
- #pragma config(Motor, port1, flashlight, tmotorVexFlashlight, openLoop, reversed)
- #pragma config(Motor, port2, rightMotor, tmotorVex393_MC29, openLoop)
- #pragma config(Motor, port3, leftMotor, tmotorVex393_MC29, openLoop)
- #pragma config(Motor, port9, servoMotor, tmotorServoStandard, openLoop)
- //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
- task main()
- {
- /*
- while(1 == 1)
- {
- if (SensorValue(lightSensor)>700)
- {
- turnFlashlightOn(flashlight, 127);
- }
- else
- {
- turnFlashlightOff(flashlight);
- }
- }
- // if/else may be preferable because this way the true condition doesn't need to be rewritten backwards to allow function
- */
- /*
- while(1 == 1)
- {
- while(SensorValue(limitSwitch)==1)
- {
- if(SensorValue(lightSensor)>700)
- {
- turnFlashlightOn(flashlight, 127);
- }
- else
- {
- turnFlashlightOff(flashlight);
- }
- }
- }
- */
- /*
- while(1 == 1)
- {
- if(SensorValue(bumpSwitch)==1)
- {
- turnLEDOn(green);
- wait(.05);
- turnLEDOff(green);
- wait(.05);
- }
- else
- {
- turnLEDOff(green);
- }
- }
- */
- /*
- while(1 == 1)
- {
- while(SensorValue(bumpSwitch)==1)
- {
- if(SensorValue(sonar)>20)
- {
- startMotor(leftMotor, 63);
- }
- else
- {
- startMotor(leftMotor, -63);
- }
- }
- stopMotor(leftMotor);
- }
- */
- /*
- while(1 == 1)
- {
- if(SensorValue(lineFollower)>2000)
- {
- setServo(servoMotor, 127);
- }
- else
- {
- setServo(servoMotor, -127);
- }
- }
- */
- /*
- while(1 == 1)
- {
- if(SensorValue(bumpSwitch)==1)
- {
- if(SensorValue(lineFollower)>2000)
- {
- setServo(servoMotor, 127);
- }
- else
- {
- setServo(servoMotor, -127);
- }
- }
- else
- {
- setServo(servoMotor, 0);
- }
- }
- */
- /*
- while(1 == 1)
- {
- if(SensorValue(bumpSwitch)==1)
- {
- startMotor(leftMotor, 63);
- }
- else
- {
- stopMotor(leftMotor);
- }
- if(SensorValue(limitSwitch)==1)
- {
- startMotor(rightMotor, 63);
- }
- else
- {
- stopMotor(rightMotor);
- }
- }
- */
- /*
- 1. We didn't seem to encounter any issues in programming this.
- 2. If else loops make sense where two seperate states are required based on one condition, while loops would be more useful for a boolean application only requiring an on or off action.
- */
- }
Advertisement