Skip to content

Add Keyboard Serial example from arduino.cc #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions examples/Serial/Serial.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
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.

http://www.arduino.cc/en/Tutorial/KeyboardSerial
*/

#include "Keyboard.h"

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);
}
}