Digital inputs and outputs:
Because I didn’t make a homemade switch last week I decided to include one this week for fun:
Above I’m using a potentiometer as my analog input. In the code, the pot value was divided by four to represent the brightness of the LED, from 0 to 255.
For the last part of the lab, I picked photocells as my variable resistors:
In the video above I’m just checking to see that the values were registering. 3.92 represents the amount of voltage, but I’m still not sure what the “800” means in this context.
The more light the photo cells were exposed to, the dimmer the LEDs. I wonder how I could change the code to make it the opposite (more light = brighter LEDs).
I wish I could have experimented more this time around, but I made a stupid mistake that had me stuck for a long time–I forgot to supply power to the photocells! I am also realizing that I’m going to need to get a pair of wire cutters. The wire situation is starting to get out of hand.