Download presentation
Presentation is loading. Please wait.
Published byPaulina Whitehead Modified over 9 years ago
1
Light, Sound, and Ultrasonic Sensor
2
Doc leJOS API –http://lejos.sourceforge.net/nxt/nxj/api/index.html leJOS Tutorial –http://lejos.sourceforge.net/nxt/nxj/tutorial/index.htm MMN Lab.
3
Light Sensor Constructor –LightSensor(SensorPort port) –LightSensor(SensorPort port, boolean floodlight) ) Method –int readValue() Higher numbers indicate more light –Int readNormalizedValue() MMN Lab.
4
Light Sensor cont’d Sample program MMN Lab.
5
Sound Sensor Constructor –SoundSensor(SensorPort port) –SoundSensor(SensorPort port, boolean dba) Method –int readValue() –Void setDBA(boolean dba) MMN Lab.
6
Sound Sensor cont’d Sample program MMN Lab.
7
Ultrasonic Sensor Constructor –UltrasonicSensor (SensorPort port) Method –int getDistance() MMN Lab.
8
Ultrasonic Sensor cont’d Sample program MMN Lab.
9
Lab4 Scenario –1. Move forward until light sensor detects the black area –2. Use the sound sensor such that the arm will hit the ball away after a indication –3. Start to move and stop before bumping into the wall Hint –For the arm, you can use Motor.PORT.Method to do some action MMN Lab.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.