How to: Monitor for certain keystroke?
SteveWoodrough
Posts: 190
I thought for sure I've seen this done, but I cannot find the example or derive the logic.
I want to check to see if a certain key x is pressed. If no key is pressed or something other than x is pressed then return to the main loop. Ive tried a few ideas but nothing works. The program hangs waiting for a key. I want NULL to be an answer if the loop times out. The alternative is to use another cog to monitor key stokes, but I really thought this has been done before.
Thanks,
Steve
I want to check to see if a certain key x is pressed. If no key is pressed or something other than x is pressed then return to the main loop. Ive tried a few ideas but nothing works. The program hangs waiting for a key. I want NULL to be an answer if the loop times out. The alternative is to use another cog to monitor key stokes, but I really thought this has been done before.
Thanks,
Steve
pub check_key | count '' checks for key input count:=cnt repeat until cnt > (clkfreq + count) if fds4.rx(BT)=="x" ' receive a byte repeat fds4_terminal_samples_BT
Comments