PDA

View Full Version : Basic Stamp Project



Coopdaddy
10-23-2009, 02:43 AM
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.

JD
10-23-2009, 03:14 AM
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 (http://www.parallax.com)

looong4
11-01-2009, 02:24 PM
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

skylight
11-01-2009, 09:46 PM
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 (http://www.datasheetcatalog.org/datasheet/lsi/LS7220.pdf)

Post Edited (skylight) : 11/1/2009 2:59:41 PM GMT

Franklin
11-02-2009, 12:33 AM
Something like:
if 4 then
if 2 then
if 3 then
if 1 then light green led
else light red led

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

looong4
11-02-2009, 01:09 AM
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...

Franklin
11-02-2009, 05:05 AM
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

RiJoRi
11-04-2009, 05:04 AM
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