Skip to content

Instantly share code, notes, and snippets.

@avtolstoy
Created March 11, 2016 12:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avtolstoy/996cb3bb174337744094 to your computer and use it in GitHub Desktop.
Save avtolstoy/996cb3bb174337744094 to your computer and use it in GitHub Desktop.
#include "application.h"
SYSTEM_MODE(MANUAL);
Serial1DebugOutput dbg(57600, ALL_LEVEL);
void setup() {
Serial.begin(9600);
USBSerial1.begin(9600);
Mouse.begin();
Keyboard.begin();
}
void loop() {
while (1) {
if (Serial.available() > 0) {
int32_t c = Serial.read();
if (c == '\n' || c == '\r') {
USBSerial1.println();
} else if (c == 'k') {
Keyboard.print("test");
} else if (c == 'm') {
Mouse.move(100, 100, 0);
} else {
USBSerial1.write((char)c);
}
}
if (USBSerial1.available() > 0) {
int32_t c = USBSerial1.read();
if (c == '\n' || c == '\r') {
Serial.println();
} else if (c == 'k') {
Keyboard.print("test");
} else if (c == 'm') {
Mouse.move(100, 100, 0);
} else {
Serial.write((char)c);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment