Lab #2: Sensors, knobs, and Serial Data

Sunday, March 1, 2020

Week 2 - Resistor and Serial Communication



LAB 1 - Serial Data

Task: Using the hello sketch, play with the serial monitor to tell a story. It can be around 3 lines long. 

Idea: User would press any of the button in the bread board, for every button the serial monitor would display a fun fact about waffles. 

How it Works




LAB 3 - Light Dependent Resistors

Task: Make LED change brightness depending on the light level.


LAB 4 - Common Sensors

Task: Work in groups of 4, understand how the sensor works. 

a. Temperature Sensor



How it works: Each LED light has a designated pin, the warmer the Temperature Sensor detects, the more LED light turn on. In other words, LED light is proportional to the increase of temperature. Initially, we set a base line temperature of 20 C (Room temperature). The code is a range of "if" functions, where detected temperature is compared to the baseline temperature, like so:

b. Sharp distance sensor



How it works: it detects the dominant object that is directly in front of the sensor, it determines the distance of the object from the sensor itself. The code arrangement was simple as we were just trying to understand how the sensor work, so it the code consisted of setting up the integer of sensor, opening up the serial monitor to display the quantified distance, and the analogRead command that will read the distance. The structure of the code is like this: 


Learning Points
This series of lab works helped me understand the versatility of an Arduino boards, it also introduced me in incorporating sensors that helped build my coding skills as the presence of structure means there are more considerations to be aware of when coding.



Links:
© Hilary Young. .