-
Notifications
You must be signed in to change notification settings - Fork 1
/
Potentiometer_Test.ino
62 lines (51 loc) · 1.12 KB
/
Potentiometer_Test.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
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
int readPot4(){
return analogRead(16);
}
int readPot3(){
return analogRead(17);
}
int readPot2(){
return analogRead(18);
}
int readPot1(){
return analogRead(19);
}
void loop() {
// put your main code here, to run repeatedly:
if(readPot1() <= 1023){
Serial.println("X");
delay(500);
}else if(readPot1() == 0 ){
Serial.println("Y");
delay( 500);
}
Serial.print(readPot1());
if(readPot2() <= 1023){
Serial.println("X");
delay( 500);
}else if(readPot2() == 0 ){
Serial.println("Y");
delay( 500);
}
Serial.print(readPot2());
if(readPot3() <= 1023){
Serial.println("Y");
delay(500);
}else if(readPot3() == 0 ){
Serial.println("X");
delay( 500);
}
Serial.print(readPot1());
if(readPot4() <= 1023){
Serial.println("Y");
delay( 500);
}else if(readPot4() == 0 ){
Serial.println("X");
delay( 500);
}
Serial.print(readPot2());
}