Shop OBEX P1 Docs P2 Docs Learn Events
Is It Possible...? — Parallax Forums

Is It Possible...?

Im New To MicroIm New To Micro Posts: 42
edited 2010-12-04 09:51 in BASIC Stamp
Hi everyone,

I was wondering is it possible to control High and Low signals as well as other features of the Board of Education board with different keys on the keyboard.

For example,

Lets say I have one LED in my circuit and I wish to be able to turn this LED on and off by pressing either the UP arrow key on the keyboard or the DOWN arrow key on the keyboard. So the UP arrow key would be to turn the LED on, and the DOWN arrow key would be used to turn the LED off.

Is this possible?

I know with DEBUGIN you have to type in values/text into the box, but that's not what I'm seeking here, I just want to be able to basically program it in a such a way where events can be controlled by different keys on the keyboard.

Thanks

Comments

  • Im New To MicroIm New To Micro Posts: 42
    edited 2010-12-03 22:51
    Nevermind, I figured it out, or the command I'm using seems to do the trick.

    For those who may come accross this thread later and wanting to do the same thing I'm doing, look at my example code below:

    This code turns a LED connected to PIN15 ON if you press the "1" key on your keyboard, and OFF if you press the "2" key on your keyboard.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    keyboardKey VAR Nib

    DO

    DEBUGIN DEC1 keyboardKey

    IF (keyboardKey = 1) THEN 'if you press 1
    HIGH 15
    ENDIF

    IF (keyboardKey = 2) THEN 'if you press 2
    LOW 15
    ENDIF

    LOOP

    I'm not sure how you can set this up for any character on the keyboard, unless it's possible to just use the regular DEBUGIN and compare ascii characters. But you may or may not have to press "Enter" after inputting your character, but I haven't even tried this yet since the above code is more than enough to do what I need.
  • $WMc%$WMc% Posts: 1,884
    edited 2010-12-04 09:51
    You can also send ASCII code.
    '
Sign In or Register to comment.