via LadyAda.

Need

  • Arduino Uno (+ USB cable, power cable, software)
  • 2 each of red, green, and blue LEDs
  • 6 resistors
  • tissue paper for diffusing

Code

int redPin = 12;
int greenPin = 11;
int bluePin = 10; 
void setup() {
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
}

void loop() {
  digitalWrite(redPin, HIGH);
  digitalWrite(greenPin, HIGH);
  digitalWrite(bluePin, HIGH);
  delay(1000);
  digitalWrite(greenPin, LOW);
  digitalWrite(bluePin, LOW);
  delay(1000);
  digitalWrite(bluePin, HIGH);
  delay(1000);
  digitalWrite(redPin, LOW);
  delay(1000);
  digitalWrite(greenPin, HIGH);
  delay(1000);
  digitalWrite(bluePin, LOW);
  delay(1000);
  digitalWrite(redPin, HIGH);
  delay(1000);
}

Circuit

Results

I added an origami paper box (instructions here) for a diffuser.

(Edit: Apparently my camera can’t take pictures in low light. I’ll add an image as soon as I can get my hands on a better one.)

Advertisements