-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRevolver 4-1 Task 1.c
28 lines (25 loc) · 1.08 KB
/
Revolver 4-1 Task 1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma config(Sensor, port3, TouchLED, sensorVexIQ_LED)
#pragma config(Sensor, port4, LineSensor, sensorVexIQ_ColorGrayscale)
#pragma config(Sensor, port7, PerpLineSensor, sensorVexIQ_ColorGrayscale)
#pragma config(Motor, motor1, LeftDrive, tmotorVexIQ, PIDControl, encoder)
#pragma config(Motor, motor5, RightDrive, tmotorVexIQ, PIDControl, reversed, encoder)
#pragma config(Motor, motor11, FifthWheel, tmotorVexIQ, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
setColorMode(port4, colorTypeGrayscale_Reflected);
while (true)
{
writeDebugStreamLine("%d", getColorGrayscale(port4));
setMotorSpeed(LeftDrive,40);
setMotorSpeed(RightDrive,40);
if(getColorGrayscale(port4)<80)
setMotorSpeed(FifthWheel,5);
else if(getColorGrayscale(port4)<200)
setMotorSpeed(FifthWheel,-10);
if(getColorGrayscale(port7)<80)
setTouchLEDRGB(port3, 0, 50, 0);
else if(getColorGrayscale(port7)<200)
setTouchLEDRGB(port3, 0, 0, 0);
}
}