Skip to content

Instantly share code, notes, and snippets.

@dj1711572002
Created December 20, 2020 05:40
Show Gist options
  • Save dj1711572002/0ad8aa8aee618e5f2b7bfa719bc2b736 to your computer and use it in GitHub Desktop.
Save dj1711572002/0ad8aa8aee618e5f2b7bfa719bc2b736 to your computer and use it in GitHub Desktop.
M5StickC_Serial1-2_JIkken2_COM5
//M5StickC_Serial1-2_JIkken2_COM5.ino
#include <M5StickC.h>
int i;
void setup() {
M5.begin();
Serial.begin(115200);
Serial1.begin(115200, SERIAL_8N1, 26, 0); // RX26 TX0 EXT_IO
Serial2.begin(115200, SERIAL_8N1, 33, 32);// RX33 TX32 Grove
}
void loop() {
i++;
//COm4へ送信
Serial2.write(i);
delay(10);
//COM4から返信をSerial1で受信する
if (Serial1.available()) {
// Serial2(Grove) to Serial(PC)
int inByte = Serial1.read();
Serial.print("Serial1_Receive from COM4:");
Serial.println(inByte);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment