dumped all my old arduino stuff in here.
This commit is contained in:
parent
8cc6f23f59
commit
8f8959b76f
76 changed files with 8127 additions and 2 deletions
37
ps2_kbd/ps2_kbd.pde
Normal file
37
ps2_kbd/ps2_kbd.pde
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* an arduino sketch to interface with a ps/2 keyboard.
|
||||
* Also uses serial protocol to talk back to the host
|
||||
* and report what it finds. Used the ps2 library.
|
||||
*/
|
||||
|
||||
#include <ps2.h>
|
||||
|
||||
/*
|
||||
* Pin 5 is the ps2 data pin, pin 6 is the clock pin
|
||||
* Feel free to use whatever pins are convenient.
|
||||
*/
|
||||
|
||||
PS2 kbd(6, 5);
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
kbd.init_kbd();
|
||||
}
|
||||
|
||||
/*
|
||||
* get a keycode from the kbd and report it back to the
|
||||
* host via the serial line.
|
||||
*/
|
||||
void loop()
|
||||
{
|
||||
unsigned char code;
|
||||
|
||||
for (;;) { /* ever */
|
||||
/* read a keycode */
|
||||
code = kbd.read();
|
||||
/* send the data back up */
|
||||
Serial.println(code, HEX);
|
||||
// delay(20); /* twiddle */
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue