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