From 2f5d7eb50e5396d115c45f63b1f94e1a238dacb3 Mon Sep 17 00:00:00 2001 From: giulcioffi Date: Thu, 1 Apr 2021 12:37:20 +0200 Subject: [PATCH] Use just one MKR board to do both Serial and Eslov Passthrough --- Arduino_BHY2_HOST/examples/Passthrough/Passthrough.ino | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Arduino_BHY2_HOST/examples/Passthrough/Passthrough.ino b/Arduino_BHY2_HOST/examples/Passthrough/Passthrough.ino index 88833410..881c3934 100644 --- a/Arduino_BHY2_HOST/examples/Passthrough/Passthrough.ino +++ b/Arduino_BHY2_HOST/examples/Passthrough/Passthrough.ino @@ -13,12 +13,16 @@ // Set DEBUG to true in order to enable debug print #define DEBUG false +Serial_ SerialUSB2(USBDevice); + void setup() { + Serial.begin(115200); + Serial1.begin(115200); + SerialUSB2.begin(115200); #if DEBUG // When the passthrough is enabled, Serial is busy -> // so it cannot be used for debugging. Serial1 is used instead - Serial1.begin(115200); BHY2_HOST.debug(Serial1); #endif @@ -27,5 +31,8 @@ void setup() void loop() { + if (Serial1.available()) { + SerialUSB2.write(Serial1.read()); + } BHY2_HOST.update(); }