Update the serial tests

This commit is contained in:
Matt McWilliams 2023-07-04 17:15:26 -04:00
parent 318f931dbf
commit 1d6cbe5c53
2 changed files with 28 additions and 26 deletions

View File

@ -2,21 +2,27 @@
#include <Arduino.h>
#define RXD2 16
#define TXD2 -1
#define TXD2 17
#define LOG_LOCAL_LEVEL ESP_LOG_INFO
#include "esp_log.h"
#include <esp32-hal-log.h>
HardwareSerial Serial2(1);
volatile char cmd = 'z';
void setup () {
Serial2.begin(57600, SERIAL_8N1, RXD2, TXD2);
Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
}
void loop () {
now = millis();
if (Serial2.available() > 0) {
//cmdChar = Serial2.read();
cmd = Serial2.read();
}
if (cmd == 'x') {
Serial2.print('x');
}
}

View File

@ -1,19 +1,3 @@
/**
*
* Camera Remote Menu
*
*
*
*
*
* Camera Settings
*
*
*
*
*
**/
#include <SoftwareSerial.h>
#define SOFTWARE_RX 10
@ -21,14 +5,26 @@
SoftwareSerial softPort(SOFTWARE_RX, SOFTWARE_TX);
volatile char cmd = 'z';
volatile long now;
volatile long start;
void setup () {
softPort.begin(57600);
softPort.begin(9600);
start = millis();
pinMode(LED_BUILTIN, OUTPUT);
}
void loop () {
now = millis();
if (softPort.available() > 0) {
//sChar = softPort.read();
cmd = softPort.read();
}
if (cmd == 'x') {
digitalWrite(LED_BUILTIN, HIGH);
}
if (now >= start + 5000) {
softPort.print('x');
}
}