1 / 6

THE LIGHT SENSOR

THE LIGHT SENSOR. The Light Sensor gives your robot some kind of vision. It can distinguish between light and dark assigning a number between 0 (completely dark) and 100 (maximum light).

Download Presentation

THE LIGHT SENSOR

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. THE LIGHT SENSOR The Light Sensor gives your robot some kind of vision. It can distinguish between light and dark assigning a number between 0 (completely dark) and 100 (maximum light). It can also detect the light intensity of colored surfaces thanks to its Light Emitting Diode, so that it is possible to recognize colors.

  2. SENSOR HARDWARE SCHEMATIC The circuit is not so simple, but it is easy to recognize the LED and the light sensor. On the right the input port connection is drawn. The NXT Light Sensor has a range of states between 0 and 100. The lower the number, the darker the reading is.

  3. Connecting the light sensor to the NXT The input port and the cable have six connections. The connection can be used to get digital, analog and I2C signals and to supply power to the connected sensor.

  4. What can you do with a light sensor? You can use the Light Sensor detect the light in a room. The Light Sensor can be use to follow a black line on a white floor. You can write a program that makes your robot move on a table without fall down.

  5. Programming the Light Sensor with NXC NXC, is a high-level programming language for NXT. NXC has a syntax similar to C language. Before using a sensor you have to declare its connecting input: SetSensorLight( port numberS1 to S4 ); To read a value and store it in a variable: x = Sensor(port number);

  6. EXAMPLE PROGRAM task main() { SetSensorLight(S1); int x; while(true) { ClearScreen(); x=Sensor(S1); NumOut(10,LCD_LINE1,x); Wait(200); } }

More Related