Created
July 21, 2021 03:00
-
-
Save dj1711572002/1962b6b6ad7c142f4dfd31e6ed8cbac1 to your computer and use it in GitHub Desktop.
ESP32Devkit Serial1 Test Jikken6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//HardwareSerial Serial2(2);//これは不要でいれるとエラーになる | |
void setup() { | |
// initialize both serial ports: | |
Serial.begin(115200); | |
//Serial2.begin(115200); | |
Serial1.begin(115200, SERIAL_8N1, 19, 23);//GPIO19:RX=pin31,GPIO23:TX=pin37 | |
} | |
void loop() { | |
// read from port 1, send to port 0: | |
if (Serial1.available()) { | |
int inByte = Serial1.read(); | |
Serial.print("Recieved="); | |
Serial.println(inByte); | |
} | |
// read from port 0, send to port 1: | |
if (Serial.available()) { | |
int inByte = Serial.read(); | |
Serial.print("KeyIn="); | |
Serial.println(inByte); | |
Serial1.write(inByte); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment