« FINAL Blinky Glove - Bryce Davidson | Main | Prelude to Fly on the Wall Project »

Final Project

Photo 33.jpg


View image

Here is my coding, painting.pde..

int photocellPin = 0; // the cell and 10K pulldown are connected to a0
int photocellReading; // the analog reading from the sensor divider
int LEDpin = 11; // connect Red LED to pin 11 (PWM pin)
int LEDbrightness; //
void setup(void) {
// We'll send debugging information via the Serial monitor
Serial.begin(9600);
}

void loop(void) {
photocellReading = analogRead(photocellPin);

Serial.print("Analog reading = ");
Serial.println(photocellReading); // the raw analog reading

// LED gets brighter the darker it is at the sensor
// that means we have to -invert- the reading from 0-1023 back to 1023-0
photocellReading = 355 - photocellReading;
//now we have to map 0-1023 to 0-255 since thats the range analogWrite uses
LEDbrightness = map(photocellReading, 0, 355, 0, 50);
analogWrite(LEDpin, LEDbrightness);

delay(100);
}

For my project I created an interactive painting. I inserted a light sensor in the painting that would cause several blue LED lights to light up when there was a lack of light hitting the sensor. I imagined that the painting set up in an area with natural light and would change throughout the day as the light slowly turned to darkness causing the painting to glow bright blue. If i were to make another one of these paintings i would have painted the paintings with the LEDs on so that i could better play off of the light and i could match the colors better. I also wish that i could have gotten my original idea to work so that i could have programmed the LEDs to switch from one to the other based on the light sensor.