From 19c61d732affddae8d1c77cdbaf19b46102280e7 Mon Sep 17 00:00:00 2001 From: NicoHood Date: Wed, 20 May 2015 17:00:13 +0200 Subject: [PATCH] Added Simple HID-Bridge example Since I dont have any time to produce any relyable Bridge, here is a simple example. --- .../HID-Bridge_IO/HID-Bridge_IO.ino | 22 ++++++++++++ .../HID-Bridge_USB/HID-Bridge_USB.ino | 34 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 examples/Projects/HID-Bridge/HID-Bridge_IO/HID-Bridge_IO.ino create mode 100644 examples/Projects/HID-Bridge/HID-Bridge_USB/HID-Bridge_USB.ino diff --git a/examples/Projects/HID-Bridge/HID-Bridge_IO/HID-Bridge_IO.ino b/examples/Projects/HID-Bridge/HID-Bridge_IO/HID-Bridge_IO.ino new file mode 100644 index 0000000..32ce692 --- /dev/null +++ b/examples/Projects/HID-Bridge/HID-Bridge_IO/HID-Bridge_IO.ino @@ -0,0 +1,22 @@ +/* + Copyright (c) 2014-2015 NicoHood + See the readme for credit to other people. + + Serial HID-Bridge I/O + Select Arduino Uno/Mega HID-Bridge as board. + + After upload make sure the 16u2 sketch runs, not the HoodLoader2 bootloader. +*/ + +void setup() { + // start the Serial which is connected with the 16u2. + // make sure both baud rates are the same + // you can go up to 2000000 for very fast data transmission + Serial.begin(115200); +} + +void loop() { + // send random letters to the USB MCU + Serial.write(random('a', 'z')); + delay(1000); +} diff --git a/examples/Projects/HID-Bridge/HID-Bridge_USB/HID-Bridge_USB.ino b/examples/Projects/HID-Bridge/HID-Bridge_USB/HID-Bridge_USB.ino new file mode 100644 index 0000000..3073f8d --- /dev/null +++ b/examples/Projects/HID-Bridge/HID-Bridge_USB/HID-Bridge_USB.ino @@ -0,0 +1,34 @@ +/* + Copyright (c) 2014-2015 NicoHood + See the readme for credit to other people. + + Serial HID-Bridge USB + Select Arduino Uno/Mega HID-Bridge as board. + + After upload make sure the 16u2 sketch runs, not the HoodLoader2 bootloader. +*/ + +void setup() { + // start the Serial1 which is connected with the 16u2. + // make sure both baud rates are the same + // you can go up to 2000000 for very fast data transmission + Serial1.begin(115200); + + // Sends a clean report to the host. This is important on any Arduino type. + Keyboard.begin(); + + // start the USB Serial for debugging + Serial.begin(115200); +} + +void loop() { + // check if any Serial data from the I/O MCU was received + char c = Serial1.read(); + + // if it's a character, print it! + if (c >= 'a' && c <= 'z') { + Serial.print(F("USB: ")); + Serial.println(c); + Keyboard.println(c); + } +}