| |
e-textile
construction kit introduction part 3
getting started using the e-textile kit
experiment with programming
It will probably be helpful to refer to my Arduino-textile library and the Arduino software reference as you work through these excersises:
Click here for the Arduino software reference
Click here for my Arduino-textile library reference
blink the on-board LED
|
|
void setup() {
}
void loop() {
LEDOn();
delay(1000);
LEDOff();
delay(1000);
}
|
- Hook your e-textile patch up to your computer as shown above
- From the File menu in the Arduino software, select Sketchbook->Examples->_Textiles_->led
to open up the "led" sample sketch in the Arduino editor
- From the File menu, select "save as". Rename the file with a name
of your choice.
- Compile your code by clicking on the "play" icon in the upper left
corner of the Arduino window
- Download the code to your chip by clicking the right pointing arrow
at the top of the Arduino window
- Edit your program to experiment with different blinking patterns
- Click the downward pointing arrow to save your changes
use a fabric pressure switch to control the on-board LED
|
|
void setup() {
taba0Input();
}
void loop() {
while (switcha0IsPressed()) {
LEDOn();
}
LEDOff();
}
|
- Use alligator clips to attach a fabric switch to your chip as is shown
above. One end of the switch is clipped to ground (-) and the other
end is clipped to tab a0 on the textile patch. According to electronics
tradition, black is the color for gorund, so we use a black alligator
clip to make this connection.
- Open up the "switch" sketch from Sketchbook->Examples->_Textiles_in
the Arduino editor
- Click on the File menu and select "save as". Rename the file with
a name of your choice.
- Download the code to your chip
- Edit your program to obtain different behavior for different switch
presses
experiment with an RGB LED
|
|
void setup() {
initializeRGB();
LEDOff();
}
void loop() {
color(255,0,0);
delay(1000);
cycleColors();
simpleColor(128);
delay(1000);
color(0,0,0);
delay(5000);
}
|
- Use alligator clips to attach an RGB LED patch to your chip as shown
above. The RGB LED is labeled 9, 10, 11 and +. Connect the 9 tab on
the LED to tab 9 on the textile patch and so on. According to electronics
tradition, red is the color for + or power, so we use a red alligator
clip to attach + on the LED to + on the textile patch.
- Open up the "rgb_led_cycleColors" sketch from Sketchbook->Examples->_Textiles_
in the Arduino editor
- Click on the File menu and select "save as". Rename the file with
a name of your choice.
- Download the code to your chip and watch the LED
- Open up the "rgb_led_color" sketch from Sketchbook->Examples->_Textiles_
in the Arduino editor
- Click on the File menu and select "save as". Rename
the file with a name of your choice.
- Download the code to your chip
- Experiment with producing different colors
- Advanced experiment: can you get the LED to change color gradually
from green to blue and back again?
- Open up the "rgb_led_simpleColor" sketch from Sketchbook->Examples->_Textiles_
in the Arduino editor
- Click on the File menu and select "save as". Rename
the file with a name of your choice.
- Download the code to your chip
- Experiment with producing different colors
experiment with a sensor
|
|
int sensorValue;
void setup() {
taba0Input();
Serial.begin(9600);
LEDOff();
}
void loop() {
sensorValue = analogRead(a0);
Serial.println(sensorValue);
delay(200);
}
|
- Use alligator clips to attach a light or temperature sensor to your
chip as shown above. The S tab on the sensor is attached to tab a0 on
the textile patch, the - tab on the sensor is attached to - on the patch
and the + tab on the sensor is attached to + on the patch. Again, we
follow electrical convention, using a black clip for ground (-) and
a red clip for power (+).
- Open up the "sensor" sketch from Sketchbook->Examples->_Textiles_
in the Arduino editor
- Click on the File menu and select "save as". Rename the file with
a name of your choice.
- Download the code to your chip
- Open up the serial monitor in the Arduino window to obtain readings
from your sensor
- Try to get a range of readings from the sensor
design
- Where might you position tilt, pressure and light sensors to pick
up on interesting gestures?
- What are physical activities or gestures that you might exploit in
your design?
- Would you like your wearable to display something about the environment
you're in?
- What sensors could you use to probe the environment and how might
the wearable make them visible?
- What interesting or beautiful aesthetic effects could you create?
- How might you make a pedometer, a wearable clock or a wearable thermometer?
- Once you have decided which sensors and outputs you will use, think
about your electrical layout.
- What pins will you attach each component to?
- How can you incorporate your electrical stitching into your aesthetic
design?
- How will you sew things together to avoid crossing stitches as much
as possible?
- Make a sketch on paper and perhaps transfer this sketch to your garment.
construction and programming build
it!
This material is based upon work supported by the National Science
Foundation under Grant No. 0326054.
Any opinions, findings and conclusions or recommendations expressed in this
material are those of the author(s) and do not necessarily reflect the views
of the National Science Foundation (NSF).
|