Commit | Line | Data |
---|---|---|
e6e13bcc TM |
1 | #include <ps2dev.h> // to emulate a PS/2 device |
2 | PS2dev keyboard(19,18); // PS2dev object (3:clock, 2:data) | |
3 | unsigned long timecount = 0; | |
4 | ||
5 | void setup() | |
6 | { | |
7 | keyboard.keyboard_init(); | |
8 | Serial.begin(9600); | |
9 | pinMode(LED_BUILTIN, OUTPUT); | |
10 | } | |
11 | ||
12 | void loop() | |
13 | { | |
14 | //Handle PS2 communication and react to keyboard led change | |
15 | unsigned char leds; | |
16 | if(keyboard.keyboard_handle(&leds)) { | |
17 | //Serial.print('LEDS'); | |
18 | //Serial.print(leds, HEX); | |
19 | digitalWrite(LED_BUILTIN, leds); | |
20 | } | |
21 | ||
22 | //Print letter every second | |
23 | if((millis() - timecount) > 1000) { | |
24 | keyboard.keyboard_mkbrk(0x16); | |
25 | Serial.print('.'); | |
26 | timecount = millis(); | |
27 | } | |
28 | } |