LOW switch
ice-egoz
Posts: 55
Hi.. I want assign the pin to be LOW. SO when the pin becomes HIGH, then carry on the next step.
LOW switch ' does this assign the pin to be low?
IF NOT switch THEN start······· 'over here: IF the switch is on, it becomes a HIGH and den goes to start..
········································· 'but then it is not supposed to go to start if the switch is not ON yet.
start:
...
We have made a switch and used a jumper wire to put at pin 12 of the BS2p.
The switch looks like in the pic.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I need all ya guidance Masters. [noparse]:)[/noparse]
LOW switch ' does this assign the pin to be low?
IF NOT switch THEN start······· 'over here: IF the switch is on, it becomes a HIGH and den goes to start..
········································· 'but then it is not supposed to go to start if the switch is not ON yet.
start:
...
We have made a switch and used a jumper wire to put at pin 12 of the BS2p.
The switch looks like in the pic.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I need all ya guidance Masters. [noparse]:)[/noparse]
Comments
Here's a quick test you can run, using P12 as the input:
BTW ... these a very basic input circuits and fully covered in our "What's A Microcontroller?" textbook.· You can download it for free.· You really should.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Post Edited (Jon Williams) : 9/21/2004 2:36:02 AM GMT
And our switch is not a push button.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I need all ya guidance Masters. [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I need all ya guidance Masters. [noparse]:)[/noparse]
In fact, just to be safe, I want you to do this in your code:
The INPUT instruction will guarantee the P12 is an input and you won't have any problems.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I need all ya guidance Masters. [noparse]:)[/noparse]
The switch is such that, when i On it, it will sound the buzzer and the LED is ON also.
How do I figure this out?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I need all ya guidance Masters. [noparse]:)[/noparse]
the buzzer needs 12V. One wire just needs to touch any wire in the alarm circuit and it will be able to ON the alarm. And i want to automatically switch off the alarm without moving the switch. can it be done?
when it is time to OFF the switch:
LOW alarm ' is this able to oFF the switch?
the alarm has a switch, LED, buzzer.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I need all ya guidance Masters. [noparse]:)[/noparse]
As Jon mentioned, you need to download the What's a Microcontroller? text from our web site. This text covers your exact question in detail. There's a picture of the circuit and a schematic. The picture shows you where the jumper wire goes, where to put the resistor, and how to place the pushbutton switch across the breadboard.
It couldn't be easier for you - all you need to do is look in the What's a Microcontroller? text for some fantastic, well-designed examples using switches (or pushbuttons).
Please take a look at this book. Within 10 minutes you should find the example and put it to use. If you don't have 10 minutes to do this then your future learning the BASIC Stamp is in jeopardy.
Ken Gracey
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I need all ya guidance Masters. [noparse]:)[/noparse]
I follow the tread for the switch and I think the initial concept is wrong.
From what you describe , you want to have a switch , acting as an INPUT to the stamp,
and have the stamp to turn on an OUTPUT which will drive your buzzer and led. After a preset time , you want to turn the buzzer and led off without any intervention from your part. What you forgot to mention are few facts.
Is the contact on the switch permanent, or just a momentary closure ?
What you do , is after your preset time, the switch is still closed?
Are you keeping the alarm on or turn it off ?
Next point is your two voltages and currents.
Stamps work on 5Vdc, the buzzer as mentioned is 12 Vdc, and the LED usually is 1.2 Vdc. For currents point of view, you can not put in series the led with the buzzer because the buzzer it might not work on the 0.02 A which flows through your LED.
You must put them in parallel. For the LED you need a 510 Homs at ¼-watt resistor in series with it to make it works at 12 Vdc.
To save yourself some pins, you can use a 2222 transistor to drive a small relay and use the contacts to drive the 12VDC for buzzer and led. You can also use a line driver like ULN2003 chip and drive the buzzer from one pin and the led from other pin. But, if it is a mechanical buzzer , the relay works better.
Program side, use Jon’s advice to download the book from Parallax, and as a bonus use his portion of code as start. It is already half of your program there.
Good luck
Ion
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I need all ya guidance Masters. [noparse]:)[/noparse]
Jim