RGB LED Arduino Kit Test (Hello World)

Posted on

So I just received my Arduino Kit and here is the video of my first project:

 

CODE:

int redPin = 11;

int greenPin = 12;
int bluePin = 13;

void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}

void loop()
{
setColor(255, 0, 0); // red
delay(500);
setColor(0, 255, 0); // green
delay(500);
setColor(0, 0, 255); // blue
delay(500);
setColor(255, 255, 0); // yellow
delay(500);
setColor(80, 0, 80); // purple
delay(500);
setColor(0, 255, 255); // aqua
delay(500);
}

void setColor(int red, int green, int blue)
{
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}

From http://www.adafruit.com/blog/…/tutorial-arduino-lesson-3-rgbleds-arduino/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s