Ok, hopefully im being clear here. If not, ill elaborate more. For one of my current projects, ive been making a monitoring console using among other things, an old ps2 keyboard interfaced with the ps2 library. Ive gotten a lot to work with it, but i hit a pretty big snag. There is no .available() function and the .read() function does not proceed until it actually gets a full reading.
Basically i want to know the best way to implement a replacement for the .available() that serial has but for the ps2 interface so that my code can continue for until a key has been pressed. Would i need to set up an interrupt for this? im somewhat new to the idea of them.
Or another idea i had was to check the pin values (hi or low) on the clock and data lines but so far i havent been able to figure out how to do that correctly. any help or direction would be appreciated.
wierdo557, thats sorta what i currently have and at the ps2.read() the code hangs until a button is pressed. thanks mem, i looked at that code before i started and chose to use the ps2 lib because the ps2keyboard uses a hard coded interrupt on pin 3 (ps2 clock pin). now looking back at it, that seems like the reason it can have an .available() function. is that the reason?
if so, i may read up on interrupts and try to attach an interrupted function to my clock pin using the ps2keyboard code as a ref.
ok, so ive been messing around with the ps2keyboard lib and so far, ive decided im going to keep away. it utterly destroyed the code i had earlier for a "sleep" mode. that i can accept. but it doesnt have any write function which takes a ton of functionality out right off the bat. im gonna start up on figuring out an interrupt scheme for the original ps2 lib.
as a side note, anyone know why my old code would stop working now that i downloaded arduino 12? im still using the 11 exe but some really wierd compiler errors keep happening when i try to use the sleep function. (stolen from playground code library)