Index

auto-plow / ffa80fd

A wheelchair motor-propelled battery-powered ESP32-driven remote control snow plow.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
3703 Dec 2018 00:2639f7c59Update ard1.cppjoshuas3194N

Blob @ auto-plow / src / ard1 / ard1.cpp

text/plain780 bytesdownload raw
1#include "Arduino.h"
2#include "ard1.h"
3#include "serial.h"
4#include "reset.h"
5
6// One time
7void 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
22void 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