Hey guys,
So, this is week one with the Arduino for me. I ran through a number of simple tutorials online, then I went through the Getting Started with Arduino book. I had no problems whatsoever, but when I got to the end of the book, it makes the suggestion to change the final project… a three LED lamp… from three LEDs to a single RGB LED.
It just so happened that I had a few, so I set about trying this out. Somehow or another, I’m just not understanding things.
Here’s how I have it setup
1 3 and 4 on the RGB LED are wired from 330 Ohm resistors to digital pins 9, 10 and 11. 2, the longest, is wired to ground.
My sketch looks like this:
int RED = 9;
int GREEN = 0;
int BLUE = 11;
void setup()
{
pinMode(RED, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(BLUE, OUTPUT);
}
void loop()
{
for(int r = 0; r < 1024; r+=5) {
for(int g = 0; g < 1024; g+=5) {
for(int b = 0; b < 1024; b+=5) {
analogWrite(RED, r);
analogWrite(GREEN, g);
analogWrite(BLUE, b);
delay(30);
}
}
}
}
I have no idea why this wouldn’t work. I can’t figure out how to dumb it down from here either. I know the LEDs work because, if they’re wired to ground and I touch one of the color poles, it faintly lights up.
Sorry for the stupid question. I just refuse to accept defeat from something as simple as this.