Summary
Highlights
Professor De Angelis introduces the third part of the Tinkercad Arduino workshop, focusing on reading photoresistors. The initial setup involves adding an Arduino board and a small breadboard to the workspace.
The video explains that photoresistors change resistance based on light exposure (less resistance with more light, higher resistance with less light). To convert this resistance change into a readable voltage for the Arduino, a voltage divider circuit is used. The circuit is set up with a 5V input and a ground connection, completing the circuit.
The presenter demonstrates setting up the Arduino code to read the voltage from the photoresistor. This involves using 'pinMode' to set an analog pin (A0) as an input and 'analogRead' to take readings. The code is written in the text editor, initially replacing the default 'blink' code.
To view the sensor readings, the serial monitor needs to be enabled using 'Serial.begin(9600)'. The readings are stored in an integer variable, 'lightRead', and then printed to the serial monitor using 'Serial.println()' for better readability, ensuring each reading appears on a new line.
A wire is connected from the junction of the two resistors in the voltage divider to analog pin A0 on the Arduino. The fixed resistor in the voltage divider is set to 10k ohms. Running the simulation shows the sensor values changing based on the simulated light intensity, with values ranging from 49 (bright) to 969 (dark).
The video briefly covers what happens if 'Serial.begin' is forgotten (no output on the serial monitor) and reiterates the importance of including it. The video concludes, hinting at future applications like making a nightlight.