10/03 Class Notes

Working with Data:


//if it is dark
if(lightSensorValue < 200) {
//turn LED on
digitalWrite(LEDpin, HIGH);
//if it is light
else {
//turn LED off
digitialWrite(LEDpin, LOW);

Multiple Thresholds

if (condition) {
do this
} else if (2nd condition) {
do something else
} else {
do the last thing if it’s neither of the above


map(value, fromLow, from Hight, toLow, toHigh);




constrain(lightValue, 0, 255);



Homework: Finish your Pocket/Patch before class on Wednesday. Consider how and where it will attach to your body. Snaps, velcro, ties, stitch or other techniques…

Create a pocket/patch that can be attached or detached from your clothing or other surface. The pocket should contain your microcontroller, a sensor (capacitive sensor or pressure sensor) and either an LED, piezo buzzer, or Neopixel. Use conductive thread, conductive fabric, or other conductive materials to connect your circuit. Consider the placement of your battery within the pocket. We will work on placing your components, programming and calibrating your sensor on Monday in class. Complete the fabric (or other material) base for the pocket and bring everything you will need to complete it (including alternative conductive materials) on Monday. Also draw out your circuit so you have a plan about how it will lay out on the pocket. The pockets will be due at the beginning of class on Wednesday, October 5.