Work                  Events                 About

RIVEN RATANAVANH

Week 2: Sketches in Arduino, Digital Input and Output
September 21, 2021

Questions:

A microcontroller needs support components of a voltage regulator and a crystal. I did a quick search to try and understand how a crystal works, but didn’t come to a full understanding. I don’t know if it’s relevant for future assignments, but would love to hear a bit more about this in class if we’ve time. Otherwise... it’s noted as a tangential investigation for later. To satisfy my own curiosity, but I wonder if (for my interests) it may bear any fruit.


Digital Input/Output

Doing the digital input/output lab, I got stuck for 15 minutes trying to figure out why the IDE was giving me this error. The process of troubleshooting included first following a link in the error message that led me to install new software for the Nano IoT in the boards manager, then googling... I had it set to upload to an Arduino Uno, not Nano.





 
Overview of the circuit.


Uploaded to the Arduino, and it works!

Analog Input


Using the serial monitor to verify input is coming from the photocell + finding the range of the sensor.

On this photocell, in the environment of the artificially lit ITP floor, voltage ranges from 0.00 (complete darkness) to ~2.05. With a flashlight pointed directly at it, the reading goes to ~4.5 V.



From the code within the sketch, I realized that Serial.println(voltage); is similar to a function we had learned in ICM this week.




After going over sensor detection I made a button that prints a :) only when the photocell detects that the room is lit.




If I had more time, the next step would have been to print out :( if the button was pressed when the sensor was covered.