Sunday, November 15, 2015

Mini Project 2 Process 1

So For Mini project 2 I'm going to continue on my trend of wearable art.

Here are some of the links that I've been looking at for research.

http://www.instructables.com/id/LilyPad-Arduino-Sensor-Demo-Mat/

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

http://www.kobakant.at/DIY/?p=1940

http://web.media.mit.edu/~leah/LilyPad/08_sensor_code.html


Also, I never was able to leave that failed project 1 behind. Since I couldn't get it to work with the conductive thread, I went back and re-wired and soldered it.


Re-tried the blink example that I couldn't get to work the first time around. It works!


Then I figured that I should try the code for the photoresistor again. So I did. It involved a lot of googling.





Here's the code I used


int led = 11; // pin the leds are connected to
int sensorPin = A3; // sensor is connected to analog pin 3
int sensorpwr = A5;
int base;
int sensorValue; // variable to store value coming from the sensor
int threshold = 30;
int brightness = 255;
int shine = 0; // how brightly it shines
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(led, OUTPUT);
  pinMode(sensorpwr, OUTPUT);
  pinMode(sensorPin, INPUT);
  digitalWrite(led, LOW); // turn led on
  digitalWrite(sensorpwr, HIGH);
  base = analogRead(sensorPin);
}

// the loop function runs over and over again forever
void loop() {
  //set brightness of leds
  int v = analogRead(sensorPin); //if its less light than base reading and threshold
  sensorValue = analogRead(sensorPin);
  if((base - v) > threshold) {
    analogWrite(led, brightness);
  }
  else{
    analogWrite(led, LOW);
  }

}

So I decided to concede defeat on that front of awesomeness.

Instead of light. I figured I would investigate motion in this next mini project. Specifically, the accelerometer. I want o bring the party with me.







No comments:

Post a Comment