Description
For this week's lab, I was inspired by lighted jewelry boxes. I created a jewelry holder that mimics this effect and lights up once jewelry is placed on the stand. Once you place bracelets on the jewelry holder, a photocell is blocked from light and a blue LED illuminates the glass of the holder.
https://vimeo.com/77006870
Components
1- Arduino Uno
1- USB Cable
1- Breadboard
1-10K Ohm resistor
1- Photocell
1- Blue LED
6- Jumper wires
1- Plastic cup
Code
/*Lab 5 Kristina Hart
LED Jewelry holder
*/
void setup() {
// initialize serial communications (for debugging only):
Serial.begin(9600);
}
void loop() {
// read the sensor:
int ledPin = 13;
pinMode(ledPin, OUTPUT);
int sensorReading = analogRead(A0);
int val = analogRead(0);
Serial.write(sensorReading);
// print the sensor reading so you know its range
Serial.println(sensorReading);
val = map(val, 0, 1023, 0, 99);
if (val <= 80) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}
- Login to post comments