Total Pageviews

2010/05/20

Jely Fish






Proposal of cushion that uses Breath Air(TOYOBO). The image of jelyfish was designed. Blinking similar light to breathing of sleeper is produced by using LilyPad Arduino internally.The light of five LED has branched with fiberglass. Work of the fourth grader 2009.




●Arduino sketch

int timer = 1000;

int pins[] = {
3, 5, 6, 9, 11 };

int num_pins = 5;
int Xpin = 2;
int Ypin = 3;
int Zpin = 4;
float Xin = 0;
float Yin = 0;
float Zin = 0;
float Xlebel = 0;
float Ylebel = 0;
float Zlebel = 0;

float Xfade = 0;
float Yfade = 0;
float Zfade = 0;
void setup()

{

int i;

Serial.begin(9600);
// analogReference(INTERNAL);
for (i = 0; i < num_pins; i++)
pinMode(pins[i], OUTPUT);
}/




void loop()

{

int i;

int fade;




Xin = analogRead(Xpin)/4;
Yin = analogRead(Ypin)/4;
Zin = analogRead(Zpin)/4;

Serial.print(Xin);
Serial.print(";");
Serial.print(Yin);
Serial.print(";");
Serial.print(Zin);
Serial.print(";");


Xlebel = Xin/256;
Ylebel = Yin/256;
Zlebel = Zin/256;

Xfade = Xlebel;
Yfade = Ylebel;
Zfade = Zlebel;


for ( fade = 1 ; fade <= 255 ; fade ++ ){

analogWrite( 3, Xfade );
analogWrite( 5, Yfade );
analogWrite( 6, Zfade );

analogWrite( 9, fade );
analogWrite(11, fade );

Xfade = Xfade + Xlebel;
Yfade = Yfade + Ylebel;
Zfade = Zfade + Zlebel;

delay(510/fade);
}


for ( fade = 255 ; fade >= 1 ; fade -- ){

analogWrite( 3, Xfade );
analogWrite( 5, Yfade );
analogWrite( 6, Zfade );
analogWrite( 9, fade );
analogWrite(11, fade );

Xfade = Xfade - Xlebel;
Yfade = Yfade - Ylebel;
Zfade = Zfade - Zlebel;

delay(510/fade);
}

delay(1000);
}


video video