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