Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Arduino Light Blending Tutorial

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
3,308
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jan 28, 2008

THis was a tutorial using red, green, and blue led's to blend color and create violet, yellow, and turquiose and have all of these colors blink on and off.

Code:
int redPin = 12; // Red LED connected to digital pin 12
int greenPin = 11; // Green LED connected to digital pin 11
int bluePin= 10; // Blue LED connected to digital pin 10

void setup() // run once, when the sketch starts
{
pinMode(redPin, OUTPUT); // sets the digital pin as output
pinMode(greenPin, OUTPUT); // sets the digital pin as output
pinMode(bluePin, OUTPUT); // sets the digital pin as output
}

void loop() // run over and over again
{
digitalWrite(redPin, HIGH); // sets the Red LED on
digitalWrite(greenPin, LOW); // sets the Green LED off
digitalWrite(bluePin, LOW); // sets the Blue LED off
delay(2000); // waits for half a second
digitalWrite(redPin, HIGH); // sets the Red LED on
digitalWrite(greenPin, HIGH); // sets the Green LED on
digitalWrite(bluePin, LOW); // sets the Blue LED off
delay(2000); // waits for half a second
digitalWrite(redPin, LOW); // sets the Red LED off
digitalWrite(greenPin, HIGH); // sets the Green LED on
digitalWrite(bluePin, LOW); // sets the Blue LED off
delay(2000); // waits for half a second
digitalWrite(redPin, LOW); // sets the Red LED off
digitalWrite(greenPin, HIGH); // sets the Green LED on
digitalWrite(bluePin, HIGH); // sets the Blue LED on
delay(2000); // waits for half a second
digitalWrite(redPin, LOW); // sets the Red LED off
digitalWrite(greenPin, HIGH); // sets the Green LED on
digitalWrite(bluePin, HIGH); // sets the Blue LED on
delay(2000); // waits for half a second
digitalWrite(redPin, LOW); // sets the Red LED off
digitalWrite(greenPin, LOW); // sets the Green LED off
digitalWrite(bluePin, HIGH); // sets the Blue LED on
delay(2000); // waits for half a second
digitalWrite(redPin, HIGH); // sets the Red LED on
digitalWrite(greenPin, LOW); // sets the Green LED off
digitalWrite(bluePin, HIGH); // sets the Blue LED on
delay(2000); // waits for half a second
}

Category:

Science & Technology

Tags:

License:

Standard YouTube License

  • likes, 1 dislikes

Link to this comment:

Share to:
see all

All Comments (2)

Sign In or Sign Up now to post a comment!
  • So do you just plug in LEDs to the specified pins or is there any more circuitry?

  • Hey this is awesome, also-I love you for including the code. I'm switching over from a BASIC stamp to an Arduino and I need to learn the new language. Thanks!

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more