-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIQ_Jobs-new.h
56 lines (53 loc) · 1.84 KB
/
IQ_Jobs-new.h
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
void sensorInit()
{
string x = getColorValue(colorSense);
setTouchLEDBlinkTime(feedbackLED, 5, 2.5);
setTouchLEDColor(feedbackLED, colorOrange);
if(getColorProximity(colorSense) <= 150){
//displayCenteredBigTextLine(2, y);
//displayCenteredBigTextLine(2, x);
displayBigTextLine(2, "%s", z);
}
}
void tilt(int side) //tilts the seesaw attatchment to either the left or the right depending on the m&m colo
{
// 0 is equal to left
// 1 is equal to right
if(side == 0){ //if the side is equal to 0 (left), then tilt the seesaw to that side so m&m is sorted
//motor[seesaw] = -63; //the speed that the seesaw is tilted at is 63
setTouchLEDColor(feedbackLED, colorRed); //change LED to red
displayCenteredBigTextLine(2, "RED");
setMotorSpeed(seesaw, -60);
delay(1000);
//motor[seesaw] = 0;
}
if(side == 1){ //if the side is equal to 1 (right), then tilt the seesaw to that side so m&m is sorted
//motor[seesaw] = 63; //the speed that the seesaw is tilted at
setTouchLEDColor(feedbackLED, colorGreen); //change led to green
displayCenteredBigTextLine(2, "GREEN");
setMotorSpeed(seesaw, 60);
delay(1000);
//motor[seesaw] = 0;
} //void is pseudo-ish rn
}
task sortSide()
{
//char colorVal = getColorName(colorSense);
while(true){
// 0 is equal to left
// 1 is equal to right
if(getColorName(colorSense) == colorGreen){ //if the color is sensed as say, red, then tilt to the left and deposit the m&m
tilt(1); //void tilt to tilt seesaw left at a speed of 63
}
if(getColorName(colorSense) == colorRed){ //if the color is sensed as say, green, then tilt to the right and deposit the m&m
tilt(0); //void tilt to tilt seesaw right speed of 63
}
else{
displayCenteredBigTextLine(2, z);
//setTouchLEDColor(feedbackLED, x);
}
y = getColorMode(colorSense);
g = getColorMode(colorSense);
z = getColorName(colorSense);
}
}