Shop OBEX P1 Docs P2 Docs Learn Events
reading data — Parallax Forums

reading data

niconico Posts: 28
edited 2009-11-23 07:54 in BASIC Stamp
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
640 x 400 - 15K

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2009-11-22 13:31
    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
    ·
  • niconico Posts: 28
    edited 2009-11-23 03:47
    Do I need to·use a 220ohm resistor if i connect the output of the relay to the stamp ?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-23 04:13
    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?
  • niconico Posts: 28
    edited 2009-11-23 07:54
    yes we will burn the bs. thanks everyone.
Sign In or Register to comment.