1 / 15

Programming a Motor

Programming a Motor. By Joshua Shaw. From the last Power Point. We have previously added a While Loop We are now going to use it for programming the robot. Add a Motor. Inside the While Loop a set of brackets appear, this is where we will create the program

haig
Download Presentation

Programming a Motor

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. Programming a Motor By Joshua Shaw

  2. From the last Power Point • We have previously added a While Loop • We are now going to use it for programming the robot

  3. Add a Motor • Inside the While Loop a set of brackets appear, this is where we will create the program • First lets add a motor to the program • Since motor outlets “1” and “10” are not permitted for use in competition, we will not use them in the program • Click the “+” beside Joystick under the Function Blocks • Click and drag the JoystickTo Motor function to the vertical line between the brackets in your While Loop • When you do this, a dialog box appears

  4. Motor Programming • The Joystick to Motor dialog box should look like this • However, we can not use Motor 1 in the competition • For this example we will use Motor 2 • We do this by clicking on the down arrow in the motor box and select Motor 2

  5. Transmitter Channel • A Transmitter Channel allows you to select which buttons or joysticks on the Joystick Controller you want to use for a specific purpose • In this program we are going to use the left hand joystick to operate the wheels and the right hand joystick to operate an arm and a claw • We can also change the Channel the same way as we changed the Motor • For this example we will use Channel 1 • Which just so happens to be the default • Finally click Ok • You can create as many motor programs as you need for your program. • But lets keep this one simple

  6. Motor Controlled by Buttons • We will now create a motor program that operates with buttons instead of the joystick • Go to the Function Block • Under the Joystick folder • Click and drag the Joystick Digital to Motor onto the vertical line between the bracket boxes in the While Loop

  7. Motor Controlled by buttons cont’d • The program for the motor in this example will look similar to the default • The difference is that the Motor # will be “5” and not “2” • Change the number by clicking on the down arrow • Then click on the “5” • Lets change the Channel to “6” the same way we changed the Motor #

  8. Completed Motor Controlled by Buttons Program • The final program for the motor will look like this • Finally click OK

  9. Using the Joystick Controller – Channel 6 • You will use the Channel 6 on the Joystick Controller • Push the top right button to move the motor to the left • Push the bottom right button to move the motor to the right • When you let off of the button the motor will slow down and stop

  10. Test the Program Again • Before we move any farther it is best to save the program. • It is also good to save it on a mobile hard drive • This gives the advantage to access the program on another computer that has Easy C • Now lets test the robot • Download the program to the Cortex. You can refer back to the downloading procedure illustrated in slide thirteen thru slide seventeen • Now test the program. slide eighteen

  11. Analog -vs- Digital Programming • The downside to using this program, which enables the buttons to control the motor, is that you can not vary the speed of the motor • The motors speed remains constant at all times • The first program that we created with a motor, which was controlled by a joystick, allows you to control the speed of the motor • It is known as an analog program

  12. Noise Pollution • As you have probably notice, the motors of your robot give off a high pitch whining sound • This is due to the slight push on the joysticks from any number of forces • Slight breeze • Gravity • Slight push from the fingers • It is able to be fixed fairly easily

  13. Reducing Noise for Channel 1 Motor • Go back to the Function Block • Go to the Joystick commands • Drag and drop the Joystick Analog Deadbandbetween the Variable box and the While box • Since we have a motor that is controlled by Channel 1 on the Joystick Controller. We will reduce the noise of this motor by setting the Analog Channel # to “1” • Set both the Positive Deadbandand Negative Deadband to “20”

  14. Completed Deadband Program • The program should look like this • Push OK • Now do this as may times as needed • In this example we need three of these programs because we have three motors • Each motor requires one of these programs to keep the noise down

  15. Next PowerPoint • The next PowerPoint is Programming a Servo

More Related