LAB - DIGITAL & ANALOG INPUT/OUTPUT

For this assignment I played around with digital input and output to create the circuit. I found it was a little bit easier to understand the circuit now that we are using code as I was able to clearly see the commands such as digitalWrite or read and pinModes.

For the first lab, I followed along with the instructions on the syllabus. I had two LEDs as digital outputs and a pushbutton as digital input. Initially I thought my circuit wasn’t working as the green LED light’s was very dim and I couldn’t see it. I changed the resistor and the light was brighter.

Then I moved on to controlling an LED with a potentiometer. First I set up the breadboard as per the instructions and then worked on the code. Since I could see what was control the brightness and what was controlling the potentiometer, it was easier to understand.

Initially I had the potentiometer on the other side of the breadboard and nothing connecting it to the circuit so it didn’t work. Once someone pointed it out to me I was able to fix it and get the circuit working.

Potentiometer and LED
IMG_4895.jpg

For the next lab I worked on controlling an LED light with a photo resistor/light sensor. Setting up the breadboard was very similar to the way it was set up with the potentiometer with the exception that I needed to add a resistor. I realized a potentiometer is a resistor in itself, so that’s why I didn’t need one in the previous lab.

Initially, I thought the circuit wasn’t working due to the resistors (as per the same lab) because it dimmed the light but it didn’t go off entirely. To check this, I found out the range of the light sensor using the serial.println function which was 4 - 212 which I believe is the reason why it wasn’t shutting off completely when trying it out.

Thinking about potential ideas for the the midterm project I was wondering - is it possible to completely dim/shut off a light with a sensor? Does the depend on the code or the type of sensor?

For the creative idea, I worked with Abie and Winnie and tried to control a servo motor with a pushbutton but we could not get it to work. We were powering the servo motor and got it working without the pushbutton but not with it. We found code for similar projects before and from it I understood it the controlling of it was dictated by a for loop that set it to rotate 180 degrees. We believe our mistake was in setting up the breadboard but couldn’t figure out where it was.

IMG-2988.JPG