Wednesday, November 18, 2015

mini Project 2 Process 3

http://www.kasperkamperman.com/blog/arduino/arduino-programming-map-and-smooth/

http://lilypadarduino.org/?p=384

http://web.media.mit.edu/~leah/LilyPad/build/accelero_shirt.html

http://www.geeetech.com/wiki/index.php/LilyPad_Accelerometer_ADXL335

Due to the issues regarding the use of the conductive thread, I decided to make wearables with jewelry and the jumper wires instead of the thread and hoodie.


I had a metal bracelet lying around, so I took some black felt and super-glued it to the outside of the band to keep the circuits from touching it and shorting out.
Then I attached the wires to the accelerometer before super-gluing it to the felt. It took a couple tries because the felt kept soaking up the glue. 


I really liked how the colors looked coming from it, much better than the boring metallic gray  of the conductive thread, almost liked veins. I think itis much happier, more whimsical looking, which is good because I want this to be something you want to wear. Something you'd be willing to playfully interact with. 



I wanted to attach the Lilypad main board to my arm, but I did not have any jewelry cuffs that would fit my biceps. So I used some elastic bands, which I would like to replace with an actual cuff in the final. 



The three leds lightup differently depending on the movement of my arm, and the accelerometer. 






So here's the code I used.
    
    // the setup routine runs once when you press reset:
    void setup() {
      // initialize serial communication at 9600 bits per second:
      Serial.begin(9600);
      pinMode(11, OUTPUT);
      pinMode(10, OUTPUT);
      pinMode(9, OUTPUT);
      digitalWrite(11, LOW);
      digitalWrite(10, LOW);
      digitalWrite(9, LOW);
    }
   
    // the loop routine runs over and over again forever:
    void loop() {
      // read the input on analog pin 0:
      int xValue = analogRead(A3);
      delay(1);
      int yValue = analogRead(A4);
      delay(1);
      int zValue = analogRead(A5);
      // print out the value you read:
   
      Serial.print("X value is: ");
      Serial.println(xValue);
      Serial.print("Y value is: ");
      Serial.println(yValue);
      Serial.print("Z value is: ");
      Serial.println(zValue);
   
      Serial.println(" "); // Makes a space between the readings

 //making leds glow

 float mappedx = map(xValue, 230, 390, 0, 255 );
 float mappedy = map(yValue, 230, 390, 0, 255 );
 float mappedz = map(zValue, 230, 390, 0, 255 );

analogWrite(11, mappedx);
analogWrite(10, mappedy);
analogWrite(9, mappedz);

      delay(1000);
   
}


No comments:

Post a Comment