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