2023-07-04 02:44:43 +00:00
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
|
|
#define RXD2 16
|
2023-07-04 21:15:26 +00:00
|
|
|
#define TXD2 17
|
|
|
|
|
|
|
|
#define LOG_LOCAL_LEVEL ESP_LOG_INFO
|
|
|
|
#include "esp_log.h"
|
|
|
|
#include <esp32-hal-log.h>
|
|
|
|
|
|
|
|
volatile char cmd = 'z';
|
2023-07-04 02:44:43 +00:00
|
|
|
|
|
|
|
void setup () {
|
2023-07-04 21:15:26 +00:00
|
|
|
Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
|
2023-07-04 02:44:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop () {
|
|
|
|
if (Serial2.available() > 0) {
|
2023-07-04 21:15:26 +00:00
|
|
|
cmd = Serial2.read();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmd == 'x') {
|
2023-07-04 22:45:51 +00:00
|
|
|
Serial2.print(cmd);
|
2023-07-04 02:44:43 +00:00
|
|
|
}
|
2023-07-04 22:45:51 +00:00
|
|
|
cmd = 'z';
|
2023-07-04 02:44:43 +00:00
|
|
|
}
|