Skip to content

Instantly share code, notes, and snippets.

@di0ib

di0ib/cylon.pde Secret

Created January 6, 2017 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save di0ib/45f08aa0ae811f22270f78e127d42234 to your computer and use it in GitHub Desktop.
Save di0ib/45f08aa0ae811f22270f78e127d42234 to your computer and use it in GitHub Desktop.
#include "UsbKeyboard.h"
// If the timer isr is corrected
// to not take so long change this to 0.
#define BYPASS_TIMER_ISR 1
byte KBK[128] = {
0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 0, 44, 30, 52, 32, 33, 34, 36, 52, 38, 39, 37, 46, 54, 45, 55, 56, 39, 30, 31, 32, 33, 34, 35, 36, 37, 38, 51, 51, 54, 46, 55, 56, 31, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 47, 49, 48, 35, 45, 53, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 47, 49, 48, 53, 76 };
boolean KBM[128] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0 };
void setup() {
pinMode(13, OUTPUT);
pinMode(5, OUTPUT);
digitalWrite(13, HIGH);
digitalWrite(5, HIGH);
#if BYPASS_TIMER_ISR
// disable timer 0 overflow interrupt (used for millis)
TIMSK0&=!(1<<TOIE0); // ++
#endif
UsbKeyboard.update();
for (int StD=0;StD<3000;StD++){
delayMs(10);
digitalWrite(13, !digitalRead(13));
UsbKeyboard.update();
}
}
#if BYPASS_TIMER_ISR
void delayMs(unsigned int ms) {
/*
*/
for (int i = 0; i < ms; i++) {
delayMicroseconds(1000);
}
}
#endif
void loop() {
for (int fgd=0;fgd<10;fgd++){
UsbKeyboard.update();
for (int loops = 0;loops<10;loops++){
UsbKeyboard.sendKeyStroke(83);
UsbKeyboard.sendKeyStroke(57);
UsbKeyboard.sendKeyStroke(71);
}
for (int TD=0;TD<600;TD++){
delayMs(25);
digitalWrite(13, !digitalRead(13));
UsbKeyboard.update();
}
#if BYPASS_TIMER_ISR // check if timer isr fixed.
delayMs(20);
#else
delay(20);
#endif
}
cli();
usbDeviceDisconnect();
sei();
for (int ttt=0;ttt<300;ttt++) {
delayMs(1000);
digitalWrite(13, !digitalRead(13));
}
cli();
usbDeviceConnect();
usbInit();
sei();
for (int rrr=0;rrr<200;rrr++) {
UsbKeyboard.update();
delayMs(25);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment