1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-04 15:24:12 +01:00
Arduino/build/shared/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino
per1234 499c424d59 Use Auto Format compatible bullet character in built-in example comment lists
Tools > Auto Format in the Arduino IDE removes asterisks from the start of every line in a C style comment, causing that character to be unsuitable for use as a bullet for lists in the example comments.
2017-07-18 11:07:37 +02:00

40 lines
819 B
C++

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