Presentation is loading. Please wait.

Presentation is loading. Please wait.

Program ultrasonic range sensor in autonomous mode

Similar presentations


Presentation on theme: "Program ultrasonic range sensor in autonomous mode"— Presentation transcript:

1 Program ultrasonic range sensor in autonomous mode

2 Program ultrasonic range sensor in autonomous mode
Performance Objective: Given the components of a VEX robotics design system program an ultrasonic range sensor in autonomous mode to have the robot travel forward until it is 12 inches from the wall. Enabling Objectives: explain the purpose of an ultrasonic range sensor explain how an ultrasonic range sensor operates draw a flow chart for using an ultrasonic range sensor program an ultrasonic range sensor

3 Ultrasonic range sensor
An ultrasonic range sensor enables a robot to detect obstacles in its path by utilizing the propagation of high-frequency sound waves The sensor emits a sound wave, which bounces off a reflective surface and returns to the sensor Then, using the amount of time it takes for the wave to return to the sensor, the distance to the object can be computed The distance is returned as a distance in inches

4 Sound waves The beam pattern coming from the ultrasonic sensor looks like the images to the right

5 Sound waves The sensitivity of the sensor depends on the objects’ surfaces that are detected by the emitted sound waves For example, a reflective surface may produce a different reading than a non-reflective surface

6 Verifying the sensor Plug the sensor into two digital ports
Vex Ultrasonic Sensors are labeled with reference to the sensor, so the input cable coming from the sensor should be connected as a digital output on the robot controller Open easyC and download the Ultrasonic test file Move the robot and notice the change in value of the sensor

7 Program the ultrasonic ranger sensor
The Start command tells the ultrasonic sensor to start recording sound waves The Get command allows you to store the feedback from the sensor into a variable The Stop command tells the ultrasonic sensor to stop recording

8 Program the ultrasonic ranger sensor
Program a VEX robot equipped with an ultrasonic range sensor to move forward until the robot is 12 inches from a wall Draw the flow chart of a program that can complete the above task

9 Program the ultrasonic ranger sensor
Open a new competition project and configure the microcontroller for the ultrasonic ranger finder Add a variable for the ultrasonic range sensor Insert an appropriate driving mode block into the operator tab

10 Program the ultrasonic ranger sensor
Insert a block to start the ultrasonic range sensor Insert a block to get the ultrasonic variable value NOTE: The wire from the sensor labeled output is the interrupt port in the program, and the wire labeled input on the sensor is the output port in the program

11 Program the ultrasonic ranger sensor
Insert a while loop to run while the ultrasonic sensor is greater than 16 In the while loop get the ultrasonic variable value again Insert the appropriate motor blocks to make the robot move forward NOTE: Because of processing speed in the microcontroller, you must add four inches to the distance you want the robot to stop when the motors are running at full speed (to stop the robot at 12 inches, the sensor must read until 16 inches)

12 Program the ultrasonic ranger sensor
After the while loop insert blocks to stop the motors, if you do not stop the motors they will continue to run even if the sensor is no longer greater than the value in the if statement

13 Test time Download your code and test it to see if the robot stops 12 inches from the wall If it does, show your instructor! If the robot does not stop correctly, go back through the lesson and double check your code For more technical information on the ultrasonic range sensor visit:


Download ppt "Program ultrasonic range sensor in autonomous mode"

Similar presentations


Ads by Google