Datasheet
Chapter 6 • Light-Sensitive Navigation with Phototransistors
200 • Robotics with the BOE Shield-Bot
Light Measurement Graphic Display
The Serial Monitor screen capture below shows an example of a graphical display of
the
ndShade variable. The asterisk will be in the center of the -0.5 to +0.5 scale if the light or
shade is the same over both sensors. If the shade is darker over the BOE Shield-Bot’s right
sensor, the asterisk will position to the right in the scale. If it’s darker over the left, the
asterisk will position toward the left. A larger shade/light contrast (like darker shade over
one of the sensors) will result in the asterisk positioning further from the center.
Load the LightSensorDisplay sketch into the Arduino.
Open the Serial Monitor and make sure Autoscroll is checked.
Try casting different levels of shade over each light sensor, and watch how the asterisk in the
Serial Monitor responds. Remember that if you cast equal shade over both sensors, the
asterisk should still be in the middle; it only indicates which sensor sees more shade if
there’s a difference between them.
/*
* Robotics with the BOE Shield - LightSensorDisplay
* Displays a scrolling graph of ndShade. The asterisk positions ranges
* from 0 to 40 with 20 (middle of the display) indicating same light on
* both sides.
*/
void setup() // Built-in initialization block
{
Shade over right
Shade over Left
Back to about equal
About equal light