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