$25
CS 362 Lab 4
Learning Goals:
• Be able to convert analog sensor input to digital information.
We want to start incorporating more complicated devices into our circuits.
For lab 4 your design will incorporate the light sensitive resistor photocell and display relevant
information about the photocell value onto the 16x2 display.
Prelab:
Get your photoresistor wired correctly and have the "value" read from the photoresistor output to the
serial monitor of the arduino software.
As shown here http://playground.arduino.cc/Learning/PhotoResistor
A little better schematic for wiring a photoresistor is at:
https://www.instructables.com/id/How-to-use-a-photoresistor-or-photocell-Arduino-Tu/
More information about photoresistors and their operation can be found at:
http://learn.adafruit.com/photocells
Lab 4: Due Wednesday 2/20/2019
Create a circuit and program that will use a photoresistor and the 16x2 display.
The display should state the relative amount of light in the room as one of 5 predefined text values based
on the value read from the photocell. The 5 predefined text values are:
• dark
• partially dark
• medium
• partially light
• fully lit
This involves you determining the range of values the photoresistor provides and then making reasonable
ranges for the values being considered.
To be considered completed “on time”, this Lab needs to be demonstrated by end of Lab on Wednesday
2/20/2019,
Your code must be submitted to Gradescope BEFORE you demo your lab!
Late Policy
• Late Submission - Submitted and/or demonstrated later that week (before Friday 2/22/19
11:59pm) 25% Penalty
• Late submission – Submitted and/or demonstrated during the following week (before Friday
3/1/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:
CS 362 Lab 4 Spring 2019
• Name the .ino file with your NetId and Lab Number
o I.E. something like: ptroy4Lab2.ino
• Header Comments (including the following)
o // 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