My purpose was to create a tshirt, where touching a sensor (a microphone or a pressure sensor, initially) a group of leds were illuminated follow the rope of the draw ending finally in the heart.
1.- I made a draw of the design using paper and a marker.
2.- To digitalize the image:
Having this only i had to use the plotter to obtain the vynil and i used a tshirt to obtain the final printed design:
Components:
I used a bread board with a simple LDR and leds to test the circuit and the code:
Then I sewed all the circuit to the tshirt using the conductive thread:
Code:
const int LEDPin = 13;
const int analogPin = A0;
const int umbralalto =60;
const int umbralbajo =15; here we can adjust the threshold of the LDR
int led1 = 3;
int led2 = 5;
int led3 = 6;
int led4 = 9;
int ledR = 11;
void setup()
{
pinMode(LEDPin, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT); Serial.begin(9600);
pinMode(ledR, OUTPUT);
Leds off
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(ledR, LOW);
}
void loop(){
int lectura = analogRead(analogPin);
if (lectura ⇐ umbralbajo)
{
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
delay(1000);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
delay(1000);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
digitalWrite(led4, LOW); delay(1000);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
delay(1000);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(ledR, HIGH); delay(2000); digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW); \ \ digitalWrite(ledR, LOW);
}
print the analog value:
—- ====== Final Result ======
Serial.println(GESHI_QUOTvalor=GESHI_QUOT);
Serial.println(lectura);
delay(100); delay in between reads for stability
}