Enables sending keyboard input for Arduino Uno and earlier boards using Processing as a proxy.
- Open the .pde file in Processing
- Run the Processing Sketch
- Watch the Processing console: it will display a list of available serial ports
- Adjust the setup() function in the Processing sketch to connect to the right port from the list
- Run the Processing sketch
- Click in the application window to enable the keyboard proxy
- Make sure the application you want to control is in the foreground and is the selected window
You can use the Serial library to send keyboard commands to the Processing sketch. The following keys are supported:
- "A" till "Z" and "0" till "9"
- "<" and ">" equal the left and right arrow key
- "^" and "." equal the up and down arrow key
- "_" equals the spacebar
The following code checks an analog sensor at pin A0 and sends a "_" character to the computer if the measured value is greater than 300, resulting in a emulated press on the spacebar.
int sensorPin = A0;
int prevValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
int value = analogRead(sensorPin);
if (value > 300 && prevValue <= 300) {
Serial.write("_");
}
prevValue = value;
}