StupidPetTrick – dancing Tee with a buddy
lightUpManinSeries from gabriella levine on Vimeo.
The main problem with the technical aspects of this garment is that there are many wires that extend from the tee-shirt. Options to remedy this are use stranded wires that are more flexible, or use different breadboard circuits.
Read on for some photos of my work process:
And here’s my code:
int POTPIN = 0; //the pin for the sensor
int switchPin = 2;
int led1 = 3; //the pin for the LED first
int led2 = 4;
int led3 = 5;
int led4 = 9;
int led5 = 10;
int relay = 12;
int switchRelay = 13;
int switchStateRelay = 0;
int switchState = 0;//current state of switch , off
int lastSwitchState = 0; //previous state of the switch
int led1State = 0;//remember curret led state
int val = 0; //stores the state of the input pinvoid setup(){
Serial.begin(9600);
pinMode(switchPin, INPUT);//initialize switchPin as input to turn stuff on;//led’s 1-4 are outputs
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3,OUTPUT);
pinMode(led4,OUTPUT);
pinMode(led5, OUTPUT);
// pinMode(POTPIN, INPUT);//do I need to put this????
pinMode(relay, OUTPUT);
}void loop(){
switchStateRelay = digitalRead(switchRelay);
switchState = digitalRead(switchPin);//check to see if the switch is on or off by compere
//it to its last state – if switchPin is enacted, switchstate will be true?if(switchState ==1)//check if button is pressed
{//and if button IS pressed check led state :
// digitalWrite(led1, switchState);
val = analogRead(POTPIN);
Serial.println(val);if (val >200)
{
analogWrite(led1, 255);
}
else { analogWrite(led1,0);}if(val>150 ||val<50) { analogWrite(led2, 255); } else {analogWrite(led2, 0);} if(val>100val<50 ) { analogWrite(led3, 255); } else { analogWrite(led3, 0); } if(val>75 ||val<50) { analogWrite(led4, 255); } else{ analogWrite(led4,0); } if (val>51 ||val<50){ analogWrite(led5,255); } else{analogWrite(led5,0); } if(switchStateRelay ==1)//check if button is pressed {//and if button IS pressed check led state : // digitalWrite(led1, switchState); digitalWrite( relay, HIGH); } else{digitalWrite(relay,LOW);} } else // the switch is off { //turn off all the leds digitalWrite(led1, 0); digitalWrite(led2,0); digitalWrite(led3, 0); digitalWrite(led4,0); digitalWrite(led5,0); digitalWrite(relay,0); } } }