Shop OBEX P1 Docs P2 Docs Learn Events
Help reading buttons — Parallax Forums

Help reading buttons

IrritantIrritant Posts: 2
edited 2004-07-30 21:08 in BASIC Stamp
I'm not new to stamps, but I never seem to get far enough along to figure out how to accomplish what I want to do.

I'd like to know if someone could point me in the right direction:

I have 8 magnetic reed switches and a serial LCD. (seetron)·and a BS2
I'd like to display a message on the LCD corresponding to the individual inputs.

If all 8 are open/closed, then all 8 messages should display one at·a time.

So far my programs don't work properly.

I'm ripping my hair out for something this simple

Please help.

Comments

  • Tracy AllenTracy Allen Posts: 6,656
    edited 2004-07-28 01:09
    You'll need to provide a little more information about how you have the buttons hooked up and where the messages come from. Break your problem down into smaller tasks, and ask when you get stuck on those.

    Your first micro goal should be to display the results of pressing buttons on the debug terminal, with a display like
    %00110110
    that shows a 0 or a 1 for each switch.

    Then, see if you can display "hello" on each line of your LCD screen.

    Then, display the switch states (e.g. , like %00110110) on the LCD screen as well asf on the Debug screen.

    Then you are ready for the messages finale with a modicum of hair remaining!

    -- Tracy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • weydevweydev Posts: 9
    edited 2004-07-28 08:41
    this is basically what your after i think. not sure on the display constants / layout but this work on what i have to hand at the mo which is a 16*2 serial. gives you something to play with .





    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '******************************************display constants

    '16468 set up 9600 8 data bits no parity
    LCD_CLS············ CON 1
    scroll_l········· CON 24
    n96n_Baud········· CON 16468

    'var
    pin_status· VAR Byte· 'test routine variable

    '*******************************************routine start

    DIRS=%1111111100000000······· 'pins 0-7 inputs, pins 8-15 outp
    PAUSE 1000
    SEROUT 16,n96n_baud, [noparse][[/noparse]254,132,"TEST MODE "]


    TOP:
    pin_status=INL········· 'read the value of the inputs into pin_status

    SEROUT 16,n96n_baud, [noparse][[/noparse]254,194,"I/P=",DEC INL.BIT0,DEC INL.BIT1,DEC INL.BIT2,DEC INL.BIT3,DEC INL.BIT4,DEC INL.BIT5,DEC INL.BIT6,DEC INL.BIT7,"······················ "]
    ······'display the active i/ps

    GOTO TOP········· 'repeat
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-07-28 14:21
    It's much easier than you're making it. Try this:

    · SEROUT pin, baud, [noparse][[/noparse]254, 194, BIN8 pin_status]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • IrritantIrritant Posts: 2
    edited 2004-07-30 21:06
    Thanks for the help.

    I look at the suggestions and I wonder what the hell I was thinking!

    Tracy, thanks for the walk through.

    weydev, thanks for the example and

    John, I appreciate your help as well.

    I just wish I had a better handle on the whole programming thing. My mind doesn't seem to grasp the "obvious"

    Is there any resource for the programming challenged? I have the parallax book, I have Scott Edwards Stamp book, and both of them seem to gloss over things that I don't seem to understand.

    any help would be appreciated.

    thanks!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-07-30 21:08
    I think you'll find experience is the best teacher. Keep working with BASIC Stamps, spend some time at Tracy's (way cool) web site, and it will all come together.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
Sign In or Register to comment.