mirror of
https://github.com/m5stack/M5Stack.git
synced 2026-05-20 10:06:46 -07:00
28 lines
443 B
Arduino
28 lines
443 B
Arduino
#include <M5Stack.h>
|
|
|
|
|
|
void setup() {
|
|
|
|
M5.begin();
|
|
|
|
Serial.begin(115200);
|
|
|
|
// Serial2.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert)
|
|
Serial2.begin(115200, SERIAL_8N1, 16, 17);
|
|
pinMode(5, OUTPUT);
|
|
digitalWrite(5, 1);
|
|
}
|
|
|
|
void loop() {
|
|
|
|
if(Serial.available()) {
|
|
int ch = Serial.read();
|
|
Serial2.write(ch);
|
|
}
|
|
|
|
if(Serial2.available()) {
|
|
int ch = Serial2.read();
|
|
Serial.write(ch);
|
|
}
|
|
}
|