canon_ble #82

Merged
mattmcw merged 149 commits from canon_ble into main 2023-08-01 03:38:52 +00:00
3 changed files with 23 additions and 10 deletions
Showing only changes of commit dd03583a27 - Show all commits

4
.gitignore vendored
View File

@ -5,4 +5,6 @@
node_modules
dist
*.svd
*.svd
*debug_custom.json
*debug.cfg

View File

@ -20,6 +20,7 @@ void loop () {
}
if (cmd == 'x') {
Serial2.print('x');
Serial2.print(cmd);
}
cmd = 'z';
}

View File

@ -5,26 +5,36 @@
SoftwareSerial softPort(SOFTWARE_RX, SOFTWARE_TX);
volatile char proxy = 'z';
volatile char cmd = 'z';
volatile long now;
volatile long start;
void setup () {
Serial.begin(57600);
softPort.begin(9600);
start = millis();
pinMode(LED_BUILTIN, OUTPUT);
}
//////
// Sending an x character to the nano over
// Serial will proxy it to the ESP32 over SoftSerial
// which will reflect it back to the Nano
// and will turn on the built-in LED. Proof of
// concept round trip
//////
void loop () {
now = millis();
if (Serial.available() > 0) {
proxy = Serial.read();
softPort.print(proxy);
}
if (softPort.available() > 0) {
cmd = softPort.read();
}
if (cmd != 'z') {
Serial.println(cmd);
}
if (cmd == 'x') {
digitalWrite(LED_BUILTIN, HIGH);
}
if (now >= start + 5000) {
softPort.print('x');
}
cmd = 'z';
}