Created
December 20, 2020 05:00
-
-
Save dj1711572002/a9320aeb07493e0589286c839ae35f69 to your computer and use it in GitHub Desktop.
M5StickC_Serial1-2Test_Koki_Jikken4
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
//M5StickC_Serial1-2_JIkken4-EXT-Grove_Seial1-2_COM4.ino | |
#include <M5StickC.h> | |
int i; | |
// COM5=>COM4=>COM5 LoopBack | |
void setup() { | |
M5.begin(); | |
Serial1.begin(115200, SERIAL_8N1,0,26); // RX06 TX26 EXT_IO | |
Serial2.begin(115200, SERIAL_8N1, 33, 32);// RX32 TX33 Grove | |
} | |
void loop() { | |
//COM5からGrove-Serial2受信する | |
if (Serial2.available()) { | |
int inByte = Serial2.read(); | |
Serial.print("Grove-Serial2_Receive from COM5:"); | |
Serial.println(inByte); | |
//EXT-Serial1からCOM5へ返信 | |
Serial1.write(inByte); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment