2013-10-21 09:58:40 +02:00
|
|
|
/*
|
2017-07-15 00:30:34 +02:00
|
|
|
Keyboard test
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2017-07-15 00:30:34 +02:00
|
|
|
For the Arduino Leonardo, Micro or Due
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2017-07-15 00:30:34 +02:00
|
|
|
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.
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2017-07-15 00:30:34 +02:00
|
|
|
The circuit:
|
|
|
|
- none
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2017-07-15 00:30:34 +02:00
|
|
|
created 21 Oct 2011
|
|
|
|
modified 27 Mar 2012
|
|
|
|
by Tom Igoe
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2017-07-15 00:30:34 +02:00
|
|
|
This example code is in the public domain.
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2017-07-15 00:30:34 +02:00
|
|
|
http://www.arduino.cc/en/Tutorial/KeyboardSerial
|
2017-07-15 00:35:58 +02:00
|
|
|
*/
|
2011-12-16 21:58:42 +01:00
|
|
|
|
2015-07-15 16:05:28 +02:00
|
|
|
#include "Keyboard.h"
|
|
|
|
|
2011-12-16 21:58:42 +01:00
|
|
|
void setup() {
|
|
|
|
// open the serial port:
|
2012-11-04 22:49:14 +01:00
|
|
|
Serial.begin(9600);
|
2012-03-27 21:00:24 +02:00
|
|
|
// initialize control over the keyboard:
|
|
|
|
Keyboard.begin();
|
2011-12-16 21:58:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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:
|
2013-10-21 09:58:40 +02:00
|
|
|
Keyboard.write(inChar + 1);
|
|
|
|
}
|
2011-12-16 21:58:42 +01:00
|
|
|
}
|