hello everyone i have arduino R3 and i want to play with RGB LED anyway light intensity.
so my problem is i connect the anode of white led to the Analog input and i use digital write it's not working.
so when i connect it to the digital input it is working not exactly what i planed analogWrite from 0 to 130 it's not turning the led on from 132 it turn on to the maximum brightness.
and so when i use common cathode RGB led i'm not really getting mixed collor it's like 3 different led Red Blue and Green sometime i can see mixed color bad the three main color are visible.
is that the led manufacture problem or me ??
- Properly post the code you are using.
- Make sure you are using one of the PWM pins which are 3,5,6,9,10 and 11 with the analogWrite command.
- You have a Arduno Uno R3. R3 is just the revision, Uno is why more important.
- Try to hit the shift and . a bit more often.
christou2c:
so my problem is i connect the anode of white led to the Analog input and i use digital write it's not working.
so when i connect it to the digital input it is working not exactly what i planed analogWrite from 0 to 130 it's not turning the led on from 132 it turn on to the maximum brightness.
You said it there. An analog input NEVER functions as an output and CANNOT use digitalWrite or analogWrite. For the digital pin (which can pin set to INPUT or OUTPUT with pinMode) make sure you are using a PWM pin (marked with a ~ on most boards) for analog write. If it still doesn't work you may be encountering the fact that it is NOT actually a TRUE ANALOG output, but a modulated pulse. If you are having this problem try using a analog to digital converter.
To test the component: Try using a pot (potentiometer) in place of the analog output and hooking up a safe supply voltage. As you turn it it will vary the internal resistance and therefore the LED's supply. If this still has the wrong effect your problem is probably in the LED.
Good Luck!