forked from Harshilmalhotra/Hand_Gesture_Vocaliser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflex_sensor_display_main.ino
134 lines (98 loc) · 1.69 KB
/
flex_sensor_display_main.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
int h = A1 ;//thumb
int i = A2 ;//index
int j = A3 ;//midddle
int k = A4 ;//ring
int l = A5 ;//small / pinky
int a = 0;
int b = 0;
int c = 0;
int d = 0;
int e = 0;
int p = 0;
int q = 0;
int r = 0;
int s = 0;
int t = 0;
int y = 00000;
void setup()
{
pinMode(h,INPUT);
pinMode(i,INPUT);
pinMode(j,INPUT);
pinMode(k,INPUT);
pinMode(l,INPUT);
Serial.begin(9600);
Serial.print("System Starting \n");
delay(1500);
Serial.print("Calibrating Sensors ......\n");
delay(2000);
a =analogRead(h);
b =analogRead(i);
c =analogRead(j);
d =analogRead(k);
e =analogRead(l);
Serial.print("Done \n");
delay(500);
}
void loop()
{
y=00000;
if(analogRead(h)<a)
{
p = 1;
}
else
{
p = 0;
}
if(analogRead(i)<b)
{
q = 1;
}
else
{
q = 0;
}
if(analogRead(j)<c)
{
r = 1;
}
else
{
r = 0;
}
if(analogRead(k)<d)
{
s = 1;
}
else
{
s = 0;
}
if(analogRead(l)<e)
{
t = 1;
}
else
{
t = 0;
}
y = t*1+s*10+r*100+q*1000+p*10000;
Serial.print(y);
Serial.print("\n");
switch(y)
{
case 11111:
Serial.print("please help me.");
break;
case 1111:
Serial.print("YES");
break;
case 111:
Serial.print("NO");
break;
default:
Serial.print(" ");
}
delay(1500);
}