Shop OBEX P1 Docs P2 Docs Learn Events
How to: Monitor for certain keystroke? — Parallax Forums

How to: Monitor for certain keystroke?

SteveWoodroughSteveWoodrough Posts: 190
edited 2014-01-10 18:25 in General Discussion
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. I’ve 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

Sign In or Register to comment.