1 | #include "Arduino.h" |
2 | #include "ard1.h" |
3 | #include "serial.h" |
4 | #include "reset.h" |
5 |
|
6 |
|
7 | void oninput(String message); |
8 |
|
9 | // One time |
10 | void setup() { |
11 | digitalWrite(PIN_RESET, HIGH); |
12 | serial(); |
13 | Serial.println("ARD1: Motor Controller Active"); |
14 | Serial.print("ARD1: Setting PIN "); |
15 | Serial.print(PIN); |
16 | Serial.println("'s mode to OUTPUT"); |
17 | pinMode(PIN, OUTPUT); |
18 | Serial.print("ARD1: Turning PIN "); |
19 | Serial.print(PIN); |
20 | Serial.println(" ON"); |
21 | digitalWrite(PIN, ON); |
22 | input(oninput); |
23 | Serial.println(sizeof(&input)); |
24 | Serial.println(sizeof(callback)); |
25 | } |
26 |
|
27 | void oninput (String message) { |
28 | Serial.print("ARD1: Received information - "); |
29 | Serial.println(message); |
30 | Serial.flush(); |
31 | if (message == String("Restart")) { |
32 | Serial.println("ARD1: Restarting..."); |
33 | Serial.flush(); |
34 | reset(); |
35 | } |
36 | } |
37 |
|
38 | // Repeatedly |
39 | void loop() { |
40 | input_update(); |
41 | } |
42 |
|