-
Notifications
You must be signed in to change notification settings - Fork 0
/
SourceFile003.c
76 lines (66 loc) · 2.08 KB
/
SourceFile003.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma config(Sensor, S1, touchSensor, sensorEV3_Touch)
#pragma config(Sensor, S3, irSensor, sensorEV3_IRSensor)
#pragma config(Sensor, S4, colorSensor, sensorEV3_Color)
#pragma config(Motor, motorA, rightMotor, tmotorEV3_Large, PIDControl, driveRight, encoder)
#pragma config(Motor, motorC, armMotor, tmotorEV3_Large, PIDControl, encoder)
#pragma config(Motor, motorD, leftMotor, tmotorEV3_Large, PIDControl, driveLeft, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#define DATALOG_SERIES_0 0
#define DATALOG_SERIES_1 1
#define DATALOG_SERIES_2 2
#define DATALOG_SERIES_3 3
#define DATALOG_SERIES_4 4
#define DATALOG_SERIES_5 5
//Creates variables to store the red, green, and blue values
long redValue;
long greenValue;
long blueValue;
long hueValue;
long distanceValue;
void kehrbesen()
{
moveMotorTarget(armMotor, 520, 20);
waitUntilMotorStop(armMotor);
setMotorSpeed(armMotor, -10);
while(getTouchValue(touchSensor) == 0) {
delay(100);
}
playSound(soundLowBuzz);
setMotorSpeed(armMotor, 0);
setLEDColor(ledOrangeFlash);
delay(1000);
}
task logcolors()
{
while(true)
{
wait1Msec(10);
getColorRGB(colorSensor, redValue, greenValue, blueValue);
hueValue = SensorValue[colorSensor];
distanceValue = getIRDistance(irSensor);
datalogDataGroupStart();
datalogAddValue( DATALOG_SERIES_0, redValue );
datalogAddValue( DATALOG_SERIES_1, greenValue );
datalogAddValue( DATALOG_SERIES_2, blueValue );
datalogAddValue( DATALOG_SERIES_3, distanceValue);
datalogAddValue( DATALOG_SERIES_4, hueValue);
datalogDataGroupEnd();
}
return;
}
task main()
{
// Clear old data
datalogClear();
startTask(logcolors);
moveMotorTarget(leftMotor, 2000, 10);
moveMotorTarget(rightMotor, 2000, 10);
waitUntilMotorStop(leftMotor);
waitUntilMotorStop(rightMotor);
kehrbesen();
//moveMotorTarget(leftMotor, 580, 20);
//moveMotorTarget(rightMotor, 580, -20);
//waitUntilMotorStop(leftMotor);
//waitUntilMotorStop(rightMotor);
stopTask(logcolors);
}