sensing 5 volts from an infrared sensor ( 0 or 5 volts DC ...
Archiver
Posts: 46,084
Command that will cause the program to do nothing else but wait for the
signal..
Assuming the signal goes into pin 0 and pin 0 is configured as an
input......and pin 1 is properly interfaced to your buzzer.
LOW 1
WAIT_FOR_SENSOR:
IF PIN 0 = 1 THEN G0_DO_SOMETHING
GOTO WAIT_FOR_SENSOR:
G0_DO_SOMETHING
HIGH 1
PAUSE 1000
LOW 1
GOTO
WAIT_FOR_SENSOR:
The code above will wait for the sensor voltage to go to 5 volts. After the
sensor voltage goes to 5 volts it will sound the buzzer for 1 second, then turn
the buzzer off and again wait.
This code also assumes the buzzer will sound with a HIGH output from
stamp......stamp output goes to a transistor that will in turn ground the buzzer to
make it sound.
This is real quick and crude (no alias names for pin assignments)
Also, I strongly recommend you go through the FREE tutorials for the stamp.
http://www.parallax.com/html_pages/downloads/sw/sw.asp
Spending a little time here will answer your questions, and you will learn
better by performing the experiments. It is unlikely you would have these
questions if you go through some of the material.
ken
==================
Thanks,
The schematic is easy . But do you know about the
Basic Stamp command for this ?
The sensor has +5, gnd, signal.
I 'll try to join GNDs but I am not sure about the
command .
The sensor gives me 0(off) or +5(on) .
(it is a simple sensor)
Any suggestion please ?
[noparse][[/noparse]Non-text portions of this message have been removed]
signal..
Assuming the signal goes into pin 0 and pin 0 is configured as an
input......and pin 1 is properly interfaced to your buzzer.
LOW 1
WAIT_FOR_SENSOR:
IF PIN 0 = 1 THEN G0_DO_SOMETHING
GOTO WAIT_FOR_SENSOR:
G0_DO_SOMETHING
HIGH 1
PAUSE 1000
LOW 1
GOTO
WAIT_FOR_SENSOR:
The code above will wait for the sensor voltage to go to 5 volts. After the
sensor voltage goes to 5 volts it will sound the buzzer for 1 second, then turn
the buzzer off and again wait.
This code also assumes the buzzer will sound with a HIGH output from
stamp......stamp output goes to a transistor that will in turn ground the buzzer to
make it sound.
This is real quick and crude (no alias names for pin assignments)
Also, I strongly recommend you go through the FREE tutorials for the stamp.
http://www.parallax.com/html_pages/downloads/sw/sw.asp
Spending a little time here will answer your questions, and you will learn
better by performing the experiments. It is unlikely you would have these
questions if you go through some of the material.
ken
==================
Thanks,
The schematic is easy . But do you know about the
Basic Stamp command for this ?
The sensor has +5, gnd, signal.
I 'll try to join GNDs but I am not sure about the
command .
The sensor gives me 0(off) or +5(on) .
(it is a simple sensor)
Any suggestion please ?
[noparse][[/noparse]Non-text portions of this message have been removed]