Be able to have your aurdino do two unconnected things at the same time, using multiple inputs and outputs.
Be able to read and write to analog inputs and outputs.
Lab 5: Due Wednesday 2/27/2019
This lab we will be experimenting with multiple inputs and outputs. There will be two parts:
You will be using 4 LEDS and a photoresistor. Put all 4 LEDs next to each (preferably the same color). As the amount of light seen by the photoresistor decreases, increase the number of LEDs that are lit. For example, if your circuit receives no light then all of the LEDs should light up. As you continue to increase the amount of light, the number of LEDs that light up will decrease. So when the photoresistor receives the half the amount of light, 2 LEDS should be lit up, and when there is no light, all 4 LEDs should be lit up.
In parallel with part 1, you will be using the passive buzzer and the potentiometer. Use the potentiometer as an analog input and have the output come from another analog pin. Control the volume or tone of the buzzer by adjusting the potentiometer. Make sure to have code to control the output of the buzzer based on the potentiometer.
This is what the passive buzzer looks like from the bottom:
OPTIONAL: you can add a button to turn on and off the buzzer
If you have to older kits and don’t have a buzzer, user a servo motor and control it with your potentiometer (this should rotate and change positions based on your potentiometer).
To be considered completed “on time”, this Lab needs to be demonstrated by end of Lab on Wednesday Your code must be submitted to Gradescope BEFORE you demo your lab!
Late Submission – Submitted and/or demonstrated later that week (before Friday 3/1/19 11:59pm) 25% Penalty
Late submission – Submitted and/or demonstrated during the following week (before Friday 3/8/19 11:59pm) 50% Penalty
What should I include with my .ino Code File?
As with any code file, it should be written in Good Coding Style: in a manner that will help other people read and understand the intent, purpose, operation of the code. So your code must include:
Name the .ino file with your NetId and Lab Number o I.E. something like: ptroy4Lab2.ino
Header Comments (including the following)
// FirstName LastName, UIN and NetID o // Lab x – Title
o // Description – what is this code supposed to do?
o // Include any assumptions you may have made, what do you expect from the hardware, pinouts, particular arduino versions, etc.
o // References – where did you find code snippets, ideas, inspirations? if no references used say: “no references used”
Code is well documented/formatted with comments, indentations, and descriptive variable names
Actual code – the functions in the cpp/ino file
Academic Integrity Guidelines:
You may use any resources linked from this lab, or posted by the professor or TAs on piazza/class web page/etc. You should not look at any other internet resources for this. This is an individual assignment, and should be completed on your own. You should not show anyone your code, or look at anyone else’s code.