10. E-Textiles and Wearables II¶
We had the opporttunity to put in practice again our skills in e-textiles and wearables. This time was different, we had the previous knowledge to improve our prototypes. So this week we saw: Different types of outputs, how do we control them and what are transducers.
To Use¶
- LEDs
- Neopixels
- Sound
- Fabric speakers + amplifier circuits/code
- Powering circuits
- ATtiny
Wearable II.¶
Useful links¶
Gallery¶
An example with the photosensor¶
The photosensor...
An example with the potentiometer¶
a) led and different light levels
b) led and delay
An example with neopixeles¶
The neopixeles...
Speaker with latex¶
Circuit¶
The clue here is to have our embrodery with two types of thred, a normal one and other conductive. And that they have a circular or triangular shape with spiral lines.
What you need: 1. Speaker 2. Amplifier 3. Bottom battery 5V 4. Resistor 100 ohm 5. Magnets
First test¶
Speaker Bordado Test from Estefania Cavalie on Vimeo.
Speaker Code¶
void setup() {
// put your setup code here, to run once:
pinMode(A0,INPUT);
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
int speakerPin = A0;
analogWrite(speakerPin, 255);
tone(11,440);
delay(200);
noTone(3);
delay(1000);
}
Bracelet RGB with photosensor¶
First test¶
Second test¶
Bracelet RGB with photosensor from Estefania Cavalie on Vimeo.
Bracelet Code¶
// Código brazalete reactivo
// declaración de variables
int LDR = A3; // entrada analógica A3 para mi LDR
int ledR = 0; // entrada digital 0 para mi led color rojo
int ledG = 1; // entrada digital 1 para mi led color verde
int ledB = 2; // entrada digital 2 para mi led color azul
int valor;
void setup() {
pinMode (ledR, OUTPUT); // declaro mis pines digitales 0, 1 y 2 como salidas
pinMode (ledG, OUTPUT);
pinMode (ledB, OUTPUT);
}
void loop() {
valor = analogRead (LDR); // asigno valor de lectura de mi LDR a la entrada analógica A3
//------------------------------------color rojo (0 - 500)
if (valor < 501){ // si el valor de lectura de mi LDR es menor a 501
digitalWrite (ledR, HIGH); // prende y apaga el led rojo cada 20 milisegundos
delay (20);
digitalWrite (ledR, LOW);
delay (20);
}
//------------------------------------color verde ( 501 - 750)
if (valor >= 501 && valor < 751){ // si el valor de lectura de mi LDR esta entre 501 y 751
digitalWrite (ledG, HIGH); // prende y apaga el led verde cada 20 milisegundos
delay (20);
digitalWrite (ledG, LOW);
delay (20);
}
//------------------------------------color azul (751 - 1023)
if (valor >= 751 && valor < 1024){ // si el valor de lectura de mi LDR esta entre 751 y 1023
digitalWrite (ledB, HIGH); // prende y apaga el led azul cada 20 milisegundos
delay (20);
digitalWrite (ledB, LOW);
delay (20);
}
}