Lesson4.docx - LEGO Mindstorms Class Lesson 4 The Light Sensor The light sensor allows a Mindstorms robot to\"see the difference between light and dark

# Lesson4.docx - LEGO Mindstorms Class Lesson 4 The Light...

This preview shows page 1 - 4 out of 9 pages.

LEGO Mindstorms Class: Lesson 4 The Light Sensor : The light sensor allows a Mindstorms robot to "see" the difference between light and dark. It detects light and dark surfaces by shining a light on the surface, and seeing how much of the light bounces back to the detector. Light surfaces reflect more light, and dark surfaces reflect less light. You can also turn off the light bulb in the light sensor, and then the sensor will detect the amount of light around it. We'll work with reflected light, and use the light sensor attached to 5-Minute Bot to detect dark and light surfaces that it drives over. Because lighting conditions differ depending on where you are or what time of day it is, the light sensor needs to be calibrated every time you use it under different lighting conditions (for example if you move from a dark room to a brightly lit room, or take your robot outside). What looks to be one color in a dark room may look different in bright sunlight. You have to tell the light sensor what you mean by "dark" and what you mean by "light". When you write a program that checks the light sensor, the sensor returns a value between 0 and 100. 0 is the darkest and 100 is the lightest. When you calibrate the sensor, it asks you to show it the darkest color it will be detecting, and it sets that as the 0 value. Similarly, it asks to see the lightest color you will be detecting, and it sets that value to 100. We'll see how to calibrate the sensor later on. Let's attach a light sensor to our robot. Attaching the Light Sensor to the 5-minute Bot : Take off the touch sensor from the last lesson so you are only left with the 5-minute Bot (below) 1
You will need these parts: Now we can assemble and attach the light sensor: 2
Attach the light sensor to the underside of 5-minute-Bot Connect the light sensor to Port 3 on the Brick. This is the default light sensor port. That's it! You're ready to follow the light! Calibrating the Light Sensor : You can calibrate the light sensor directly from the NXT-G programming environment, or write your own program to do it.

#### You've reached the end of your free preview.

Want to read all 9 pages?

• Spring '19
• rwewe
• Light, light sensor, Sensor Block