Bright White LED


A very bright white LED light (don't stare at it too much!).

How to Connect:

If you connect the + side of the LED to the + petal of the Lilypad and the - side of the LED to the - petal of the Lilypad then the LED will light up (provided that your Lilypad has power).

If, however, you want to be able to control the LED with your code then you need to connect the + petal of the LED to one of the Lilypad's digital I/O pins and the - petal of the LED to the - petal on the Lilypad. Any of the digital I/O pins will allow you to turn the LED on and off but if you want to fade the LED you will need to connect it to one of the PWM digital pins (3,5,6,9,10 or 11).

LED connected to Pin 13 on Lilypad powered by Battery


The Blink sketch from the Arduino examples folder shows the basic code needed to turn an LED on or off (File > Examples > Digital > Blink). The digital pin that you have your LED connected to needs to be set to HIGH to turn it on. You do this with the line digitalWrite(ledPin, HIGH). Setting the same pin to LOW will turn the LED off.

Arduino Example Blink LED Sketch
The fading sketch from the Arduino examples folder shows the basic code needed to progressively fade an LED (File > Examples > Analog > Fading). In order for this sketch to work the LED needs to be connected to one of the PWM pins e.g. 9. The line analogWrite(ledPin, fadeValue); sets the brightness of the LED. It does this using a range of values from 0 to 255 where 0 = maximum darkness and 255 = maximum brightness. The sketch steps through these values in increments that are set by the counter of the for loop.

Arduino Example Fade LED Sketch


  • Connecting multiple LEDs in series and parallel.

Tri-Color LED

Lilypad Tri-color LED

A board with three different coloured LEDs, red, blue and green. You can either turn these colours on individually or mix different brightnesses of each colour to create a new blended colour e.g. purple. Although the LEDs are quite close together, these blended colour effects look better if viewed through some kind of light diffusing material e.g. thin white fabric or white tissue.

How to Connect:

  1. Connect the + petal on the LED to the plus petal on the Lilypad.
  2. Connect the red (11) petal on the LED to the 11 petal on the Lilypad.
  3. Connect the blue (10) petal on the LED to the 10 petal on the Lilypad.
  4. Connect the green (9) petal on the LED to the 9 petal on the Lilypad.

Example Tri-Color LED Circuit


To control the three LEDs you need to write a sketch that first sets each of the pins (9,10, 11) as outputs (do this in the setup). Then you can use the analogWrite function to send values between 0 and 255 to each of the LEDs. These values work in reverse to the RGB values that you are used to seeing in Photoshop. Zero is the LED color at its maximum setting and 255 is the LED color at its minimum setting. The simple sketch below illustrates how to turn all three LEDs off and then turn just the red LED to its maximum value. It then dims the red LED and finally creates a blended color from all three LEDs. See the links below for more complex examples.

Simple Sketch to Control Tri-color LED