-
Notifications
You must be signed in to change notification settings - Fork 0
/
Step.ino
40 lines (35 loc) · 934 Bytes
/
Step.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
void oneStep (String command) {
Serial.print("Ejecting row:");
char tmp[] = {
'\0','\0','\0' };
tmp[0] = command[1];
int row = atoi(tmp);
Serial.print(row);
Serial.print(" tube:");
int col = atoi(&command[2]);
Serial.println(col);
if (row>5 || row<0 || col>7||col<0) {
Serial.println("RANGEERROR");
}
else {
String line = cmd[row];
tmp[0] = line[col*2];
tmp[1] = line[col*2+1];
if (String(tmp).compareTo("NN")!=0) {
Serial.println(tmp);
int pin = atoi(tmp);
Serial.print(" signaling pin: ");
Serial.println(pin);
Serial.println(line);
Serial.println(line[col]);
digitalWrite(13, HIGH);
digitalWrite(pin, LOW);
delay (500);
digitalWrite(pin, HIGH);
digitalWrite(13, LOW);
}
else {
Serial.println("INDEXERROR");
}
}
}