i have thought about the solution transferring data via the keyboard leds back to the teensy.
first of all its a proove of concept. (so pritty slow)
what you need.
arduino ide
teensydurino addon from pjrc.com
#include <phukdlib.h> from irongeek.com
and for the sending part:
autoit from autoitscript.com
arduino code:
#include <phukdlib.h>
int ascii = 0;
char buf[12];
int changed = 0;
void setup() {
pinMode(6, OUTPUT);
}
void loop() {
if (IsNumbOn()){
if (IsScrlOn()){
// digitalWrite(6, HIGH);
changed = 1;
}
else {
if (changed == 1){
changed = 0;
ascii += 1;
}
// digitalWrite(6,LOW);
}
}
else {
if (ascii > 0){
char thisString = ascii;
Keyboard.print(thisString);
ascii = 0;
}
}
}
and the counterpart on the pc itself, written in autoit.
Global $speed = 36 ; lesser values for faster transfer, may result in false data...
sendstring("test")
Func sendstring($string)
Send("{SCROLLLOCK off}")
Send("{NUMLOCK off}")
$src = StringSplit($string, "")
For $i = 1 To $src[0]
ConsoleWrite($src[$i] & @CRLF)
sendkey($src[$i])
Next
EndFunc ;==>sendstring
Func sendkey($key)
Send("{NUMLOCK on}")
For $x = 1 To Asc($key)
Send("{SCROLLLOCK on}")
Sleep($speed)
Send("{SCROLLLOCK off}")
Sleep($speed)
Next
Send("{NUMLOCK off}")
Sleep($speed)
EndFunc ;==>sendkey
it uses numlock to activate listening mode and sends the string as ascii codes to the teensy via scrolllock, i took those Keys to be able to type normaly during the transfer process.i may switch to binary mode when i know more about arduinos capability to use it.
maybe using num as clock and scrolllock as data line.
what i figured out when lowering the send delay below 36ms between led iterations the arduino won't be able to keep up and misses some of the signal switches.
currently i only check for the scrolllock turning of so maybe there is a performance boost hidden in it too.
to see if the arduino has understood the signal correctly i managed to return the send keys as real keys back to the computer.
now i have a hardware keyboard controlable by software on the same machine.
good for anticheating tool workarounds (when it gets faster)...
please make sure you select a keyboard enabled usb type in the arduino ide via "Tools" > "USB-Type"
thats it for now, feel free to contribute or wait.













