1 / 43

Program and Operate the Tumbler

Program and Operate the Tumbler. Program and Operate the Tumbler. Performance Objective: Program and operate the Tumbler in Tank (stick), Arcade, and Tank (button) modes, navigate the obstacle course in each mode in less than 80 seconds . Enabling Objectives:

reya
Download Presentation

Program and Operate the Tumbler

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. Program and Operate the Tumbler

  2. Program and Operate the Tumbler • Performance Objective: Program and operate the Tumbler in Tank (stick), Arcade, and Tank (button) modes, navigate the obstacle course in each mode in less than 80 seconds. • Enabling Objectives: • describe the following items: Tank (stick) mode, Tank (button) mode, Arcade mode, function block tree, main code window, while loop • describe the purpose of a while loop • explain the method for setting the configuration of the motor ports • explain the steps to program the Tumbler in Tank (stick) mode • explain the steps to program the Tumbler in Arcade mode • explain the steps to program the Tumbler in Tank (button) mode

  3. Tank Mode In tank mode the Tumbler acts like a tank The left side motors operate together using one joystick The right side motors operate together using the other joystick

  4. Start a new program Open the easyC V4 Cortex software for the start menu or desktop icon Begin a New Standalone Project Select Joystick Project (WiFi) Click OK

  5. Tree of Function Blocks This will be referred to as the function blocks tree You will use this to add functions to your code

  6. Main Code Window This will be referred to as the Main Code Window You will drag items from the functions block into the Code Window

  7. Defining Motor Ports First you want to remind yourself which motors are plugged into which ports Double click on the “Config” block in the main code window

  8. Defining Motor Ports Label the motor ports according to where the motors are located on the robot and to which port they are connected to This will make programming the motor ports easier later in this stage Click ok

  9. While Loop A while loop is a function that performs a task while something else is true For your program, you want the Joystick to control your robot while 1==1 Unless you state otherwise in your code, 1 will always be 1, therefore your remote will always control your robot with this particular code

  10. While Loop In order to use the remote, we need to create a while loop where 1==1 Drag a while loop from the program flow section of the functions tree into the code between begin and end

  11. While loop A window will pop up, type in the expression while box “1==1”. Click ok

  12. Joystick 4-Motor From the functions tree under Joystick, drag Tank 4–motor into the while loop

  13. Joystick 4-Motor Make sure the left channel (which will control the left side motors) is set to 3 and the right (which will control the right side motors) channel is set to 2 Select the appropriate motor port for the left front, left rear, right front, and right rear motors, Click ok

  14. Download Code Be sure the orange USB-to-serial cable is plugged in to both the computer and remote Turn on the microcontroller and remote, allow to sync Click Build and Download from the Build and Download Tab

  15. Download Code Click Yes that you are sure Close the reminder about the master code Allow file to download Click ok to confirm the download is complete Close the IFI/intelitek loader window

  16. Try it! Your Tumbler should now operate with the joysticks in tank mode If it runs properly, show your instructor! If you see that your motors are turning the wrong direction, proceed to the next slide

  17. Invert direction Double click on the tank function

  18. Invert direction Invert the motors that are turning in the wrong direction Invert by changing the invert direction from 0 to 1

  19. Download Code Once you have inverted the direction of the necessary motors download your new code through “build and download”

  20. Success! You are now finished programming in Tank (stick) mode. Now you can go complete the obstacle course!

  21. Arcade Mode Start new program Configure motor ports Insert While loop

  22. Arcade – 4 motor From the functions tree, drag Arcade – 4 motor into the while loop

  23. Arcade – 4 motor Make sure the Forward/Reverse Channel is set to 2 and the Rotate Channel is set to 1 Select the appropriate motor port for the left front, left rear, right front, and right rear motors, Click ok

  24. Download Code Be sure the orange USB to serial cable is plugged in to both the computer and remote Turn on the microcontroller and remote, allow to sync Click Build and Download from the Build and Download Tab

  25. Download Code Click Yes that you are sure Close the reminder about the master code Allow file to download Click ok to confirm the download is complete Close the IFI/intelitek loader window

  26. Try it! Your Tumbler should now operate with the one joystick in arcade mode If it runs properly, show your instructor! If you see that your motors are turning the wrong direction, proceed to the next slide and invert the direction of the necessary motors

  27. Invert direction Double click on the arcade function

  28. Invert direction Invert the motors that are turning in the wrong direction Invert by changing the invert direction from 0 to 1

  29. Download Code Once you have inverted the direction of the necessary motors download your new code through build and download

  30. Success! You are now finished programming in Arcade mode. Now you can go complete the obstacle course!

  31. Tank (button) Mode Start new program Configure motor ports Insert While loop

  32. Joystick Digital to Motor Because a button is used to control the motors, a digital output is needed From the functions tree under Joystick, drag Joystick Digital to Motor into the while loop

  33. Joystick Digital to Motor • Set the following for the left front motor: • Joystick # = 1 • Channel # = 5 • Forward Direction • Button # = 1 • Motor Value = 127 • Reverse Direction • Button # = 2 • Motor Value = -127 • Motor # = Appropriate

  34. Why these settings Joystick 1 will perform this function The left side buttons are channel 5 (controls left motors) Button 1 is the top button (top = forward in this case) 127 = full speed forward Button 2 is the bottom button (bottom = reverse in this case) -127 = full speed reverse

  35. Joystick to Digital Unlike when programming tank (stick) and arcade, this one function block only controls one motor Therefore, three more function blocks will need to be created to control the other three motors

  36. Creating additional blocks Try and program the other three blocks Remember to use a Joystick Digital to Motor function Pay attention to the channel, buttons, and motor numbers Proceed to the next slide once you have attempted the three function blocks

  37. Left Rear Motor

  38. Right Front Motor

  39. Right Rear Motor

  40. Download Code Download the code to the microcontroller

  41. Try it! Your Tumbler should now operate with the buttons in tank mode If it runs properly, show your instructor! If you see that your motors are turning the wrong direction, you may need to invert the direction of the motor

  42. Download Code You may have to invert the motor value (switch 127 with -127) depending on how the motors are installed Once you have inverted the direction of the necessary motors download your new code

  43. Success! You are now finished programming in Tank (button) mode. Now you can go complete the obstacle course!

More Related