Digital and Analog Inputs and Outputs

Physical Computing

Digital inputs and outputs:

dsc_0320

 

Because I didn’t make a homemade switch last week I decided to include one this week for fun:

 

Analog inputs:

 

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.

dsc_0331

One thought on “Digital and Analog Inputs and Outputs

  1. Fantastic job on the labs! The 800 value you get equals to the voltage you were seeing. 0 being 0V and 1023 being 5V anything in between would equal to the amount of voltage that the Arduino is perceiving from the sensor. Also, you CAN invert the behavior of your photocells in code! Using the map() function you can flip the range of output to 255, 0 and it will do what you wish!

Leave a Reply

Your email address will not be published. Required fields are marked *