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