Asked — Edited

Rgb Led Help Needed

Hi everyone, im having a great deal of trouble trying to sync 2 of the RGB leds i have for my robots eyes.

Just spent the last 2hrs, and some other days trying to get them to sync, so i thought it best i turn the ezb off and ask for assistance because its greatly delaying my current project...and meanwhile giving me zero confidence to start the next project for if i can't sync 2 leds... tired

Ive been close with it, but then they stray off and start to do their own thing, no matter what i do i just can't get them to join in holy matrimony.

Any help would be greatly appreciated, ive spent around 3-4 hrs total trying to figure it out as embarrassing as it is for me to say..and the more i try it seems to all go backwards and becomes much worse than when i started.


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

PRO
USA
#17  

Quote:

im having a great deal of trouble trying to sync 2 of the RGB leds i have for my robots eyes.

if you want blink two common anode rgd leds at same time:


# rgb 1 led pins
$rgb1_red=0
$rgb1_green=1
$rgb1_blue=2

# rgb 2 led pins
$rgb2_red=4
$rgb2_green=5
$rgb2_blue=6

$active=false
:loop
  if ($active=true)
    # orange
    pwm($rgb1_red, 100-99)
    pwm($rgb1_green, 100-64)
    pwm($rgb1_blue, 100-0)

    # orange
    pwm($rgb2_red, 100-99)
    pwm($rgb2_green, 100-64)
    pwm($rgb2_blue, 100-0)

    $active=false
  ELSE
    # off
    set($rgb1_red, on)
    set($rgb1_green, on)
    set($rgb1_blue, on)
    # off
    set($rgb2_red, on)
    set($rgb2_green, on)
    set($rgb2_blue, on)

    $active=true
  endif
  Sleep(500)
goto(loop)

#18  

edited my incorrect post. Missed the difference in the two diagrams and mixed up cathode and anode terms.... For something so simple, it sure does get complex.....:)

Alan

PRO
Belgium
#19  

someone told me all leds have diff speeds. you have to by a bag full leds and look for the 2 that have desame speed.

#20  

@nomad

Quote:

someone told me all leds have diff speeds.
What? In what way?

PRO
Belgium
#21  

when they change color from full leds.

PRO
Canada
#22  

I think @Nomad is talking about self-cycling RGB LEDs. They are never the same speed from one to another. They are bit analog that way.

PRO
USA
#23  

@Nomad 6R, Plain (diode only) RGB leds don't have speed.

RGB led is a single component, but the reality are 3 different leds in a single container.

Not all leds are equal, so is important to check the led details

RGB led example:

User-inserted image

All the 3 leds share the same forward current 20 ma with a max of 30 ma (before blowing up)

Different colors = Different wave lengths

User-inserted image

Different colors different forward voltages, this means in similar conditions the brightness will be different.

ohm law: I = V/R

R = 330 (builtin EZB/Iottiny resistor)

I (Red) = (3.3 - 2.0) / 330 => 3.93 mA I (Green/Blue) = (3.3 - 3.2) / 330 => 0.30 mA

This means Red will be more bright than Green and Blue

PRO
Belgium
#24  

jeremie yes i didn now the name of these leds.

php learn some again.rgb have no speed.