-
Notifications
You must be signed in to change notification settings - Fork 1
/
sen1_table.ino
111 lines (102 loc) · 2.42 KB
/
sen1_table.ino
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//------------------------------------------------------------------------//
//
// ***FUNCTION DEFINITIONS***
//
//
/*---------------------------FIND THE COLOR------------------------------*/
bool sen1Red(){
// ----------------------RED-----------------------
if (dataR >= 18 && dataR <= 26){
if (dataG >= 36 && dataG <= 45){
if (dataB >= 43 && dataB <= 54){
Serial.print("RED\n");
return true;
}
}
}
return false;
}
bool sen1Orange(){
//---------------------ORANGE----------------------
if (dataR >= 11 && dataR <= 16){
if (dataG >= 27 && dataG <= 36){
if (dataB >= 24 && dataB <= 33){
Serial.print("ORANGE\n");
return true;
}
}
}
return false;
}
bool sen1Yellow(){
//---------------------YELLOW----------------------
if (dataR >= 8 && dataR <= 15){
if (dataG >= 16 && dataG <= 25){
if (dataB >= 10 && dataB <= 18){
Serial.print("YELLOW\n");
return true;
}
}
}
return false;
}
bool sen1Green(){
//---------------------GREEN-----------------------
if (dataR >= 32 && dataR <= 44){
if (dataG >= 38 && dataG <= 52){
if (dataB >= 35 && dataB <= 48){
Serial.print("GREEN\n");
return true;
}
}
}
return false;
}
bool sen1Blue(){
//---------------------BLUE-------------------------
if (dataR >= 35 && dataR <= 44){
if (dataG >= 27 && dataG <= 38){
if (dataB >= 30 && dataB <= 45){
Serial.print("BLUE\n");
return true;
}
}
}
return false;
}
bool sen1Purple(){
//---------------------PURPLE-----------------------
if (dataR >= 27 && dataR <= 34){
if (dataG >= 22 && dataG <= 27){
if (dataB >= 25 && dataB <= 36){
Serial.print("PURPLE\n");
return true;
}
}
}
return false;
}
bool sen1Black(){
//--------------------BLACK-------------------------
if (dataR >= 42 && dataR <= 51){
if (dataG >= 46 && dataG <= 52){
if (dataB >= 47 && dataB <= 64){
Serial.print("BLACK\n");
return true;
}
}
}
return false;
}
bool sen1White(){
//--------------------WHITE-------------------------
if (dataR >= 10 && dataR <= 20){
if (dataG >= 10 && dataG <= 20){
if (dataB >= 10 && dataB <= 20){
Serial.print("White\n");
return true;
}
}
}
return false;
}