Download examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino from Beifengdo/Arduino-Development: direct link, hf CLI and curl.
- Browser
- Download file 847 Bytes
-
https://huggingface.co/datasets/Beifengdo/Arduino-Development/resolve/dca58c24f14cab87f42a37d6294a90204e9d2ffc/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino
- Command line
-
hf download hf://datasets/Beifengdo/Arduino-Development@dca58c24f14cab87f42a37d6294a90204e9d2ffc/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino
-
curl -L -o KeyboardSerial.ino https://huggingface.co/datasets/Beifengdo/Arduino-Development/resolve/dca58c24f14cab87f42a37d6294a90204e9d2ffc/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino
847 Bytes
| /* | |
| Keyboard test | |
| For the Arduino Leonardo, Micro or Due | |
| Reads a byte from the serial port, sends a keystroke back. | |
| The sent keystroke is one higher than what's received, e.g. if you send a, | |
| you get b, send A you get B, and so forth. | |
| The circuit: | |
| - none | |
| created 21 Oct 2011 | |
| modified 27 Mar 2012 | |
| by Tom Igoe | |
| This example code is in the public domain. | |
| https://www.arduino.cc/en/Tutorial/BuiltInExamples/KeyboardSerial | |
| */ | |
| void setup() { | |
| // open the serial port: | |
| Serial.begin(9600); | |
| // initialize control over the keyboard: | |
| Keyboard.begin(); | |
| } | |
| void loop() { | |
| // check for incoming serial data: | |
| if (Serial.available() > 0) { | |
| // read incoming serial data: | |
| char inChar = Serial.read(); | |
| // Type the next ASCII value from what you received: | |
| Keyboard.write(inChar + 1); | |
| } | |
| } | |