CPSC310A
Robotics

Activity 9

Mapping Input to Output

  1. Use a multimeter to measure the voltage change over the photo resistor when it is very dark (try covering the sensor with a finger) and when it is very bright (shine a flashlight on the sensor).

  2. Use the voltages from the above problem and Ohm’s law to compute the minimum and maximum resistance of the photo resistor.

  3. In Circuit 6, why is the resistor that is in series with the photo resistor a 10KΩ resistor instead of a 330Ω resistor? What would happen if the 10KΩ resistor was replaced with a 330Ω resistor?

  4. Why does the code for Circuit 6 use the constrain function? What would happen if it was not used?

  5. Modify the code of circuit 6 to behave like a car dash light, become brighter when the room becomes lighter, by only modifying the inputs to the map function. See the map documentation for information on how.