Presentation is loading. Please wait.

Presentation is loading. Please wait.

Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Program Functions for VEX Robots.

Similar presentations


Presentation on theme: "Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Program Functions for VEX Robots."— Presentation transcript:

1 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Program Functions for VEX Robots

2 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Program Functions for VEX Robots  Performance Objective: Using a bumper switch, line follower, and potentiometer, program functions to allow a robot to follow a line, touch a wall, raise a crane and then terminate.  Enabling Objectives:  describe the purpose and benefits of a function  match associated terms that define and describe functions  describe why functions are used functions  create code that develops a function  draw a flow chart for using a bumper switch, line follower, and potentiometer

3 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Functions  A function is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code?

4 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Functions  Functions allow you to reuse code rather than retyping a group of commands  Functions allow you to group a series of steps under one name.

5 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Creating Functions  Navigate to the menu item project and select Add New Function from the drop down menu.

6 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Creating Functions  A dialog box will appear which allows configuration of the function. This dialog box will allow us to name the function.  Type line follower for the functions name and Select OK.  Your done, you have create your first function. Now all you have to do is call the function.

7 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Creating Functions  Select the (tab/function) you just created, titled linefollow. Now enter the code that allows the line follower to operate.  To the right is an example of code to operate the line follow sensor. If you need assistance, please refer to lesson 3.6

8 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Calling Functions  Since our function now has code inside, we are ready to call the function from the autonomous mode/function tab.  Drag the function object into the path between variables and End and a dialog box will appear asking you configuration settings. Click OK and you have called a function

9 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Function Logic  Drawing a flow chart only requires a slight modification to what we have learned so far.

10 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Function Logic  If you notice on the right, we have a normal flow chart but notice where the function is being called drive forward. To the left is the function/mode autonomous where we call the function

11 Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Try it out  Using a bumper switch, line follower, and potentiometer, program functions to allow a robot to follow a line, touch a wall, raise a crane and then terminate


Download ppt "Available at: www.etcurr.comLesson 5.1 – Program Functions for VEX Robots Program Functions for VEX Robots."

Similar presentations


Ads by Google