EasyC Drive Code
Download
Report
Transcript EasyC Drive Code
VEX Robotics
Design System
EasyC
Drive Code
J.M. Gabrielse
Outline
• The Programming Kit
• Understanding the Controller
• Your 1st EasyC Program
• Common Problems
J.M. Gabrielse
The Programming Kit
• EasyC v2
• for VEX robots only
EasyC CD
• EasyC Pro is for VEX & 2004-2009 FRC
• USB to serial port adapter
USB
to serial
adapter
• really SLOW!
• use a serial cable if your computer has a
serial port
• dongle & telephone cables
• for connecting the robot to a computer
dongle
telephone cable
J.M. Gabrielse
• 6 channels
VEX Controller
(Transmitter)
1. x-axis of right joystick
(0-255)
2. y-axis of right joystick
(0-255)
3. y-axis of left joystick
(0-255)
4. x-axis of left joystick
(0-255)
5. right back button
(0, 127, 255)
6. left back button
(0, 127, 255)
• multiple frequencies
(replaceable crystals)
J.M. Gabrielse
Sample Program in EasyC Pro
J.M. Gabrielse
Select the VEX Controller
J.M. Gabrielse
Select the VEX Controller
J.M. Gabrielse
Select the VEX Controller
J.M. Gabrielse
Start a New Project
J.M. Gabrielse
Select the Controller Configuration
J.M. Gabrielse
Type in descriptions of what you’re going to
plug into each port.
J.M. Gabrielse
Type in descriptions of what you’re going to
plug into each port.
J.M. Gabrielse
Expand Program Flow
J.M. Gabrielse
Drag a WHILE loop onto the flow chart.
J.M. Gabrielse
Drag a WHILE loop onto the flow chart.
J.M. Gabrielse
Enter 1 (for true) to make an endless loop.
J.M. Gabrielse
Note:
Arcade = 1 joystick drive
Tank = 2 joystick drive
The number of motors
should match your robot.
Select an RC Control block.
J.M. Gabrielse
Drag your RC Control block into the while (1) loop.
J.M. Gabrielse
Select the numbered slot you plugged your left motor into.
The labels from the Controller Configuration automatically appear.
J.M. Gabrielse
Select the numbered slot you plugged your right motor into.
The labels from the Controller Configuration automatically appear.
J.M. Gabrielse
For Arcade change the Forward/Reverse Channel to 2
(the y-axis of the right joystick)
J.M. Gabrielse
For Arcade change the Rotate Channel to 1
(the x-axis of the right joystick)
J.M. Gabrielse
Congratulations!
You are done writing your program.
J.M. Gabrielse
Build & Download your program.
J.M. Gabrielse
Build & Download your program.
J.M. Gabrielse
Your program is finished downloading when
the bar goes down (erases old code)
and goes back again (loads new code).
J.M. Gabrielse
Save your program even if it didn’t work.
J.M. Gabrielse
“My code won’t download!”
(Is your robot on?)
The
POWER
switch
should be
ON.
The BATT POWER light should be green.
Make sure to turn your transmitter on too.
J.M. Gabrielse
“My code won’t download!”
(Did you use a fresh battery?)
charging station
robot
battery
controller
battery
mounting straps
What color is the BATT POWER light on the controller?
• green: okay battery
• red: dead battery
J.M. Gabrielse
“My code won’t download!”
(Is the programming cord hooked up?)
USB
to serial
adapter
telephone cable
dongle
computer
• The telephone cord should be plugged into the port labeled SERIAL
on the robot controller.
• The other end of the telephone plug should be plugged into the
dongle.
• The other end of the dongle should be attached to the computer
(either by the USB to serial adapter or a serial cable).
J.M. Gabrielse
“My code won’t download!”
(Is the correct port selected?)
Step 1:
• Go to the Build & Download
menu
• Select Loader Setup
Step 2:
• Pick a COM Port
• Try to download your
code again
Step 3:
• Keep trying all the available ports until you find one that allows you to download
J.M. Gabrielse
“My robot doesn’t drive right!”
(How did you plug the motors up?)
Everything should be plugged in according to the
Controller Configuration
J.M. Gabrielse
“My robot doesn’t drive right!”
(Did you use servos instead of motors?)
• check the label
• motors spin continuously (360° of rotation)
• servos spin back and forth (120° of rotation)
J.M. Gabrielse
“My robot doesn’t drive right!”
(Do you need to invert any of your motors?)
• Test drive your robot with all it’s wheels off the ground
• Look to see if any motors need to spin in the other direction
• Check Invert Direction to make a wheel spin in the other direction.
• Build & Download your modified code
J.M. Gabrielse