Go Down

Topic: Lilypad circuit questions - new user (Read 7 times) previous topic - next topic


I'm new to the e-textiles thing, but relatively familiar with LEd circuitry in general and hand embroidery.

I'm working on a new Iron Man inspired cosplay, and I'd really like to use the Lilypad system to create an arc reactor prop that's sewn in to the fabric of the costume itself. I'm thinking I'll probably need at least ten white LEDs and something with an on/off switch. However, I've never used a board to connect things so I'm not sure what I'll need on that front.

(basically I need a circle of lights that I can turn on and off, sewn into a top I'm making. the placement of other components is pretty flexible at this point. I'll be adding pieces over it to diffuse the light as needed)

This is what I've been looking at so far: https://www.sparkfun.com/wish_lists/61849 will these things work for what I want to do or should I be looking somewhere else?


You can attach those LEDs directly to the LilyPad pads and program it to do whatever you want them to do.  Here's an example of all the pads fading an LED: http://vimeo.com/8294038


another newb here.  Anyone know the code used in the above video?

Also, curious where a good place ppl to go to share code?


Code: [Select]

// Fade all IO by Osamu Iwasaki
// November 10, 2010

#include <MsTimer2.h>

#define OUT_MIN 0  // First pin
#define OUT_MAX 19  // Last pin (this includes the analog pins)

byte luminance[20];
byte lumi[20] = {};

void setup()
int i;

for(i = OUT_MIN; i <= OUT_MAX; i++){
   pinMode(i, OUTPUT);

for(i = OUT_MIN; i <= OUT_MAX; i++){
for(i = OUT_MIN; i <= OUT_MAX; i++){

MsTimer2::set(1, int_pwm);

void int_pwm() {

static int f_wait[20];
static int f_max_time[20];
static int f_speed[20];
static int f_ct[20];
static long f_interval[20];

static int ch;

for(ch = OUT_MIN; ch <= OUT_MAX; ch++){
   if(f_wait[ch] == 0){
     f_wait[ch] = f_speed[ch] + 1;

     if( (f_ct[ch] < 255) )
       if(luminance[ch] != 255)
         luminance[ch] ++;

     if(f_ct[ch] == 255){
       if(f_max_time[ch] == 0)
         f_max_time[ch] = 0; // On Max Time
         f_max_time[ch] --;

     if( (f_ct[ch] > 255) && (f_ct[ch] < 511) && (f_max_time[ch] == 0))
       if(luminance[ch] != 0)
         luminance[ch] --;

     if(f_ct[ch] >= 511){
       if(f_interval[ch] == 0){
         f_interval[ch] = 10 * random(100); // fading seed
         f_speed[ch] = random(100); // fading speed
         f_ct[ch] = 0;
         f_interval[ch] --;
       f_ct[ch] ++;
   f_wait[ch] --;

void fading(){

static byte counter = 0;
static boolean prev_off[20];
int i;

for(i = OUT_MIN; i <= OUT_MAX; i++){
   if(lumi[i] == 0){
     if(prev_off[i] == HIGH){
       prev_off[i] = LOW;
     lumi[i] --;

counter --;

if(counter == 0){
   for(i = OUT_MIN; i <= OUT_MAX; i++){
       prev_off[i] = HIGH;
     lumi[i] = luminance[i];

void loop(){

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

shortcuts: alt+s submit/post or alt+p preview