One day my customer told me this story: "As I was sauntering down the country road deep into a night, singing joyfully to the bats to bolster my courage amidst the darkness that swarms my body, I finally could not stand it no more and shouted into the wilderness: "Why is the world so dark? And Why can't I just know how bright the environment is all the time?" The bats flew away, and so did my soul."
I have just the perfect solution for my customer and many others who can no longer stand the unknown darkness of the world. This is an idea that dawned upon me as Professor Simar threw it in my face: why not make a device that combines the photoresistor and 7 Segment Display to display the level of light from 0 to 9? I could also add in a tilt switch to support voluntary lighting.
The product allows you to detect how bright your environment is from a level of 0 to 9. It will show you the level on the 7-segment display. An LED light will be turned on if you so choose by tilting the tilt switch. The brightness of the LED light will depend on the brightness of the environment. The darker the environment, the brighter the LED.
Hardware Components: 13 jumper wires, one LED, one 7-segment display, one 330 ohm resistor, one 10k ohm resistor, one photo resistor, one Launchpad, one Breadboard, one tilt switch
Step 1: Hook the resistors, LED, photoresistor, and jumpers up. The circuit is complete and you should be able to see the LED light up.
Step 2: Add the tilt switch by hooking it in series with the LED (place one end on the long leg of the LED) and rewire the ground (the leftmost black jumper wire) to the other end of the tilt switch. Check to make sure the LED turns on and off when you tilt it.
Step 3: Set up the 7-segment display unit.
Step 4: Hook the 7-segment display and photoresistor part in parallel
Step 5: Run the code from the bottom of the page