-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanalyzer.ino
90 lines (82 loc) · 2.33 KB
/
analyzer.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
#define green1 2 // rs
#define green2 3 // can be pulled down
#define yellow1 4 // ?
#define yellow2 5 // can be pulled down
#define purple1 6 // ? somewhat different
#define purple2 7 // ?
#define purple3 8 // can be pulled up (but with contrst changes)
#define purple4 9 // can be pulled down
#define data0 19
#define data1 18
#define data2 17
#define data3 16
#define data4 15
#define data5 14 //green
#define data6 10 //green
#define data7 11 //green
#define powerPin 12
void setup() {
pinMode(green1, INPUT);
pinMode(green2, INPUT);
pinMode(yellow1, INPUT);
pinMode(yellow2, INPUT);
pinMode(purple1, INPUT);
pinMode(purple2, INPUT);
pinMode(purple3, INPUT);
pinMode(purple4, INPUT);
pinMode(data0, INPUT);
pinMode(data1, INPUT);
pinMode(data2, INPUT);
pinMode(data3, INPUT);
pinMode(data4, INPUT);
pinMode(data5, INPUT);
pinMode(data6, INPUT);
pinMode(data7, INPUT);
pinMode(powerPin, OUTPUT);
digitalWrite(powerPin, LOW);
delay(1000);
digitalWrite(powerPin, HIGH);
Serial.begin(19200);
while (!Serial) { ; }
}
byte in;
int buff;
//unsigned long times;
void loop() {
//times = micros();
buff = 2;
if (digitalRead(green1) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(green2) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(yellow1) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(yellow2) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(purple1) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(purple2) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(purple3) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(purple4) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(data0) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(data1) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(data2) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(data3) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(data4) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(data5) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(data6) == HIGH) buff = buff | 1;
buff = buff << 1;
if (digitalRead(data7) == HIGH) buff = buff | 1;
//buff = buff << 1;
Serial.println(buff);
//Serial.println(micros() - times);
}