Top Banner
Programming a Motor By Joshua Shaw
15

Programming a Motor

Feb 22, 2016

Download

Documents

haig

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 - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Programming  a Motor

Programming a MotorBy Joshua Shaw

Page 2: Programming  a Motor

We have previously added a While Loop We are now going to use it for programming

the robot

From the last Power Point

Page 3: Programming  a Motor

3

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 Joystick To Motor function to the vertical line between the brackets in your While Loop

When you do this, a dialog box appears

Add a Motor

Page 4: Programming  a Motor

4

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

Motor Programming

Page 5: Programming  a Motor

5

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

Transmitter Channel

Page 6: Programming  a Motor

6

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

Motor Controlled by Buttons

Page 7: Programming  a Motor

7

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 #

Motor Controlled by buttons cont’d

Page 8: Programming  a Motor

8

The final program for the motor will look like this

Finally click OK

Completed Motor Controlled by Buttons Program

Page 9: Programming  a Motor

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

Page 10: Programming  a Motor

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

Page 11: Programming  a Motor

11

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

Analog -vs- Digital Programming

Page 12: Programming  a Motor

12

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

Noise Pollution

Page 13: Programming  a Motor

13

Go back to the Function Block Go to the Joystick commands Drag and drop the Joystick Analog

Deadband between 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 Deadband and Negative Deadband to “20”

Reducing Noise for Channel 1 Motor

Page 14: Programming  a Motor

14

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

Completed Deadband Program

Page 15: Programming  a Motor

The next PowerPoint is Programming a Servo

Next PowerPoint