Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp Project — Parallax Forums

Basic Stamp Project

CoopdaddyCoopdaddy Posts: 1
edited 2009-11-03 22:04 in BASIC Stamp
Trying to make an Electronic Locking device using 4 button sequence activation. Was going to use a keypad from an old push telephone, going to have to use 4 momentary switches, need help on getting started on the program.

Comments

  • JDJD Posts: 570
    edited 2009-10-22 20:14
    Coopdaddy,

    What hardware materials do you already have? For example, do you have a BASIC Stamp 2 w/ Board of Education? With this information, we can get an idea for what you have, and offer advise.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Respectfully,


    Joshua Donelson
    www.parallax.com
  • looong4looong4 Posts: 2
    edited 2009-11-01 07:24
    I was looking to do the same thing, I am looking for a basic code.
    I am very new to this. I have the basic stamp 2 BOE.
    What I am trying to do is have for example 4 push buttons, in pins 1-4 numbered 1-4.
    Say I push 4231 in sequence a green LED will come on hooked threw pin15. If it is not in that sequence a red LED will come on in P14.
    I just cant figure out how to tell the stamp to do this when...
    button 4 is pressed then unpressed
    button 2 is pressed then unpressed
    button 3 is pressed then unpressed
    button 1 is pressed then unpressed
    then turn on "high" p15
    if not high p14

    Can someone help me out?
    Thanks
  • skylightskylight Posts: 1,915
    edited 2009-11-01 14:46
    Be warned that most telephone style keypads are the matrix type so you will not be able to use them as seperate switches.
    There are common bus output keypads but they are extremely hard to source, No suppliers i can find in the UK and only one ive managed to find stock them in the US.
    Therefore you would need to sacrifice pins on your stamp to decode a matrix type or purchase a seperate decoding circuit.

    Have to resort to making my own in diptrace with momentry switches

    also have you looked at this chip

    www.datasheetcatalog.org/datasheet/lsi/LS7220.pdf

    Post Edited (skylight) : 11/1/2009 2:59:41 PM GMT
  • FranklinFranklin Posts: 4,747
    edited 2009-11-01 17:33
    Something like:
    if 4 then
    if 2 then
    if 3 then
    if 1 then light green led
    else light red led

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • looong4looong4 Posts: 2
    edited 2009-11-01 18:09
    Franklin said...
    Something like:
    if 4 then
    if 2 then
    if 3 then
    if 1 then light green led
    else light red led

    If I do this I would have to press them all in and hold them in.
    I think basically what I am looking for is a command·to·turn the light on when the button is pushed then released.

    Ive got this with 2 push buttons on 0 and 1
    and red led on 14 and green led on 15

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    DO
    IF IN0=1 AND IN1=1 THEN
    HIGH 15
    LOW 14
    PAUSE 10000
    LOW 15
    ELSE
    HIGH 14
    ENDIF
    LOOP

    the problem is I have to push both buttons at the same time. I want to push 0 then release then 1 then release then the light comes on...
  • FranklinFranklin Posts: 4,747
    edited 2009-11-01 22:05
    What I wrote was just the idea and you would not have to hold four buttons because if the first button was not 4 the if loop would fall through.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • RiJoRiRiJoRi Posts: 157
    edited 2009-11-03 22:04
    A state machine would be of help, if just to clarify your design.

    Something like:

    S1: Button 4 Pressed?
    Yes - goto S2
    No -- goto S1

    S2: Button 4 Released?
    Yes - goto S3
    No -- goto S2

    S3: Button 2 Pressed?
    Yes - goto S4
    No -- goto S1 (or goto the Error Handling routine...)

    S4: Button 2 Released?


    ... and so forth and so on.

    --Rich
Sign In or Register to comment.