Shop OBEX P1 Docs P2 Docs Learn Events
bi-color T1 LED — Parallax Forums

bi-color T1 LED

thomas_pittinthomas_pittin Posts: 29
edited 2014-01-17 05:35 in General Discussion
Hi,

i want to connect this diode (Bi Color T1 3/4 LED) to my boe-bot

the question is, what is the command to control this diode

thanks
Thomas

Comments

  • PublisonPublison Posts: 12,366
    edited 2014-01-12 10:54
    Hi,

    i want to connect this diode (Bi Color T1 3/4 LED) to my boe-bot

    the question is, what is the command to control this diode

    thanks
    Thomas

    You will want to have a 220 Ohm resistor on the LED to the pin.

    A high on the pin will light it one color, and a low will light it the other color. Which color lights will depend on the polarity.
  • thomas_pittinthomas_pittin Posts: 29
    edited 2014-01-12 11:55
    Publison wrote: »
    You will want to have a 220 Ohm resistor on the LED to the pin.

    A high on the pin will light it one color, and a low will light it the other color. Which color lights will depend on the polarity.

    thanks a lot
    Thomas
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-01-12 14:30
    Some bi-color LEDs have two pins, and the diodes are connected up back to back inside. The easy way to connect one of those is between two pins in series with a resistor (~220Ω). Then p0 high and p1 low gives 1 color, and vice versa the other. Both pins the same or inputs gives LEDs off.
    [SIZE=1][FONT=courier new]
            220       LEDs
       p0 ---/\/\/\---o--->|----o------p1
                      |         |
                      o---|<----o
    [/FONT][/SIZE]
    

    Another configuration has 3 pins with common cathode or common anode. Does your LED have 2, or 3 wires?
  • thomas_pittinthomas_pittin Posts: 29
    edited 2014-01-15 04:45
    Some bi-color LEDs have two pins, and the diodes are connected up back to back inside. The easy way to connect one of those is between two pins in series with a resistor (~220Ω). Then p0 high and p1 low gives 1 color, and vice versa the other. Both pins the same or inputs gives LEDs off.
    [SIZE=1][FONT=courier new]
            220       LEDs
       p0 ---/\/\/\---o--->|----o------p1
                      |         |
                      o---|<----o
    [/FONT][/SIZE]
    

    Another configuration has 3 pins with common cathode or common anode. Does your LED have 2, or 3 wires?

    My LED have two wires.
    i'll try your solution

    thanks in advance
  • thomas_pittinthomas_pittin Posts: 29
    edited 2014-01-16 11:07
    Now work fine

    thanks
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2014-01-17 05:35
    Hi Thomas;

    Since you have the basic 2 pin circuit running there is more you can do with them.
    Using a counter, in this case CTRA, to quickly switch back and forth between the pins.
    Here is a code snippet writen in FemtoBasic showing how to do this.
    NEW
    REM FLASH A 2 PIN BI-COLORED LED WITH CTR
    21  F = 53687 : REM FRQA 1000Hz      ( F = Hz * 53.6870912 )
    21  F =  5369 : REM FRQA 100Hz       ( F = Hz /   80MHz * 2^32 )
    21  F =   268 : REM FRQA 5Hz         ( F = Hz / 78125Hz * 2^22 )
    22  E =    $0 : REM PHSA             ( don't care )
    23  D =    $5 : REM CTRMODE  0 -> 31 ( NCO Differential )
    24  C =    $7 : REM PLLDIV   0 ->  7 ( don't care )
    25  B =    18 : REM BPIN PIN 0 -> 31 ( Connect LED To
    26  A =    17 : REM APIN PIN 0 -> 31     These Two Pins )
    27  O = 0
    40  GOSUB 200
    100 PRINT "CHOOSE 0NE OF THE 7 LED PATERNS" 
    110 INPUT "0 1 2 3 4 5 6 99 ? "; X
    120   IF X = 0 THEN O = 3 : F = 5369 : GOSUB 200
    125   IF X = 1 THEN O = 1 : F = 5369 : GOSUB 200
    130   IF X = 2 THEN O = 2 : F = 5369 : GOSUB 200
    135   IF X = 3 THEN O = 0 : F = 5369 : GOSUB 200
    140   IF X = 4 THEN O = 1 : F =  268 : GOSUB 200
    145   IF X = 5 THEN O = 2 : F =  268 : GOSUB 200
    150   IF X = 6 THEN O = 0 : F =  268 : GOSUB 200
    155   IF X > 6 THEN END
    190 GOTO 100
    200 REM MAKE LED CHANGES
    210 OUTA [B..A] = O
    220 G = D SHL 26 + C SHL 23 + B SHL 9 + A
    230 CTRA = G : FRQA = F
    290 RETURN
    RUN
    
    In this case I have the Bicolored LED connecter between pins 18 and 17, but any two pins can be used.
    Switching at 5Hz the LED kind of blinks.
    Switching at 1KHz the LED appears steady in color.
    OUTA selects the color and F selects the flash rate.
    In this case there are 7 different color & blink combinations, there can be more.

    Have fun!

    Duane J
Sign In or Register to comment.