PDA

View Full Version : reading data



nico
11-22-2009, 06:28 PM
Hi,

I have some sensors cicuit using bs2. Lets say I have a ultrasonic sensor circuit programmed by a bs2 to trigger a relay when a certain readings were read. I want to pull out a wire fromˇthe relay to connect to another bs2 so that the 2nd bs2 can read the relay's state (whether it's triggered or not. eg. 5V or 0V). But Iˇdon't know what to do inˇthe coding part andˇI was wondering if the bs2 is about to do that? I need help. I have attachedˇa drawing and I hope it helps me to explain clearer.

Thank You

stamptrol
11-22-2009, 09:31 PM
You can use the relay to switch 5 volts to the input on the second Stamp. Or, tie the output of the first Stamp to the input of the second Stamp with a 220 ohm resitor.
Just note that the Stamp probably cannot drive the relay directly unless its a very low current model.

In your program you'll have a statement something like: (see the Editor's helpfile for IF)

IF IN3 = 1 THEN
do something
ENDIF
do the other thing

Cheers,

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk

http://www.siskconsult.com
ˇ

nico
11-23-2009, 11:47 AM
Do I need toˇuse a 220ohm resistor if i connect the output of the relay to the stamp ?

Mike Green
11-23-2009, 12:13 PM
The 220 Ohm resistor is to prevent damage to either Stamp if you make a programming error and accidentally make both I/O pins outputs rather than an output and an input and accidentally make them the opposite states (high / low). You figure out what happens if the resistor isn't there.

If you connect the output of the relay to the Stamp and the fixed contacts are connected to 0V and +5V as you showed, you still need the 220 Ohm resistor for the same reason. What happens if there's an error programming the 2nd Stamp?

nico
11-23-2009, 03:54 PM
yes we will burn the bs. thanks everyone.