Shop OBEX P1 Docs P2 Docs Learn Events
bi-colored leds — Parallax Forums

bi-colored leds

ArchiverArchiver Posts: 46,084
edited 2001-08-17 23:18 in General Discussion
can i use 2 wire 2 colored leds with 1 pin of a bs2p
the led lights red or green depending on polarity
so say when pin is high the led is green
when pin is low led is red
walt@f...

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-08-17 19:53
    --- In basicstamps@y..., "walt" <walt12414@y...> wrote:
    > can i use 2 wire 2 colored leds with 1 pin of a bs2p
    > the led lights red or green depending on polarity
    > so say when pin is high the led is green
    > when pin is low led is red
    > walt@f...

    sure. just route the pin thru an appropriate resistor, say 470 ohm,
    then the green led. also route the pin thru an inverter, an
    appropriate resistor, then the red led. the inverter can be a nand
    gate or nor gate with the inputs all wired together. don't use an
    open collector inverter. the center lead of the led's goes to ground.
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-17 23:09
    >--- In basicstamps@y..., "walt" <walt12414@y...> wrote:
    > > can i use 2 wire 2 colored leds with 1 pin of a bs2p
    > > the led lights red or green depending on polarity
    > > so say when pin is high the led is green
    > > when pin is low led is red
    > > walt@f...
    >
    >sure. just route the pin thru an appropriate resistor, say 470 ohm,
    >then the green led. also route the pin thru an inverter, an
    >appropriate resistor, then the red led. the inverter can be a nand
    >gate or nor gate with the inputs all wired together. don't use an
    >open collector inverter. the center lead of the led's goes to ground.
    >
    And of course you can get RED/GREEN/NEITHER if you want to
    waste some current. Just put two of the 470 ohm resistors
    in series across the 5v supply. Tie one side of the bicolor LED
    to the junction of the two resistors and the other side to
    the STAMP pin. HIGH gives you one color, LO gives you the other,
    and switching the pin to input turns them both off.

    Reg Neale
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-17 23:18
    >--- In basicstamps@y..., "walt" <walt12414@y...> wrote:
    >> can i use 2 wire 2 colored leds with 1 pin of a bs2p
    >> the led lights red or green depending on polarity
    >> so say when pin is high the led is green
    >> when pin is low led is red
    >> walt@f...
    >
    >sure. just route the pin thru an appropriate resistor, say 470 ohm,
    >then the green led. also route the pin thru an inverter, an
    >appropriate resistor, then the red led. the inverter can be a nand
    >gate or nor gate with the inputs all wired together. don't use an
    >open collector inverter. the center lead of the led's goes to ground.

    Hi Walt,

    Another way uses a supply splitter like the TLE2426 (Texas
    Instruments--the chip provides a "virtual ground" at 1/2 the supply
    voltage--very useful TO92)

    2-lead TLE2426
    bicolor ;--;
    ;--|<--; 2.5| |--- Vdd
    P0 ----o->|---o--/\/\
    | |
    150 ohm |__|--- Vss

    high 0 ' led red
    low 0 ' led green
    input 0 ' led off

    If you are going to leave the led off (input 0) for long periods, add
    a 1 meg pullup from P0 to Vdd, in order to keep the input well above
    the Stamp switching threshold.

    -- best regards
    Tracy Allen
    electronically monitored ecosystems
    http://www.emesystems.com
    mailto:tracy@e...
Sign In or Register to comment.