Shop OBEX P1 Docs P2 Docs Learn Events
Check if Keyboard is present? — Parallax Forums

Check if Keyboard is present?

Goran (Sweden)Goran (Sweden) Posts: 68
edited 2007-01-19 23:37 in Propeller 1
I have a project where a keyboard connected now and then.

Now I want to know, in my main object, (when starting the keyaboard.spin) if the keyboard is connected.
I have tried the "PUB present : truefalse
'' Check if keyboard present - valid ~2s after start
'' returns t|f
· truefalse := -par_present

but i have not figured out how to pass the variabel to my main object where I can test this flag.

Anyone have a idea?

The whole idea with my project is to have a keyboard connected to be able to write some data and store in a SD-card and when restarting the propeller, it read from the SD-card and act depending of what stored in the SD-card.

Goran

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-19 20:52
    You don't need to pass the variable, the "present" routine will do that for you. You need to call the "start" routine of the keyboard object (key.start(...)) with the right pin information and keyboard modes, wait 2 seconds, then do "if key.present" which succeeds if the keyboard is there.
    Does this help?
    Mike
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2007-01-19 23:37
    Thanks Mike,

    I did not wait enough, when I added 2 sec it worked.

    You did it againsmile.gif

    Thanks again

    Goran
Sign In or Register to comment.