Some work with variable resistors – early signs of my stupid pet trick
I’d like to make a programmable tee-shirt, with a built in light show, also including a slot for messages, in front of the “screen”…
here’s what I have so far – I just need to make the LED’s brighter and then implant them into a shirt…
I used a push pad to turn on a series of lights (as pressure increases, more lights come on) while increasing the amplitude of a speaker.
fourLightsSpeaker from gabriella levine on Vimeo.
And below I use three photocells, each one dims an LED:
(vid)
Here’s the code:
int POTPIN = 0; //the pin for the sensor
int led1 = 5; //the pin for the LED first
int led2 = 9;
int led3 = 10;
int led4 = 3;
int speaker = 6;int val = 0; //stores the state of the input pin
void setup(){
Serial.begin(9600);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3,OUTPUT);
pinMode(led4,OUTPUT);
pinMode(speaker, OUTPUT);
// pinMode(POTPIN, INPUT);//do I need to put this????
}void loop(){
val = analogRead(POTPIN);
if (val >0 &&val<250)
{
analogWrite(led1, 255);
}
else
{
analogWrite(led1,0);
}
Serial.println(val);if(val>250&&val<450)
{
analogWrite(led2, 255);
}
else
{
analogWrite(led2, 0);
}
if(val>450&&val<650)
{
analogWrite(led3, 255);
}
else
{
analogWrite(led3, 0);
}
if(val>650)
{
analogWrite(led4, 255);
}
else
{analogWrite(led4,0);
}analogWrite(speaker, val/8);
Serial.println(speaker);