![XYZrobot K100 Скачать руководство пользователя страница 41](http://html1.mh-extra.com/html/xyzrobot/k100/k100_manual_3853273041.webp)
39
Programming the Wheels
NOTE:
The following procedure is only available for the Robotic Arm 6DW model.
You can customize the wheel control with the sequences you created in XYZrobot Editor with the use
of the Arduino application.
Customizing Wheels on Arduino
To program a wheel control to a sequence:
1.
Before starting this procedure, see
“Before You Start”
on page 33
.
2.
Connect the Robotic Arm to your computer. Connect one end of a USB cable to the computer
(USB Type A) and the other end to the Robotic Arm (USB Type Mini-B).
3.
Once connected, power up the Robotic Arm, see “Testing the Robotic Arm” in the assembly
manual.
4.
Open the Arduino software if it is not open already.
5.
Click
File > Open
and select the source file to use when programming. For instructional
purposes, the file name
RCK100_6DOF_Wheel.ino
is used here.
6.
In the file body, locate the line section named
// Button function
.
7.
In this step, you will modify the RB_1 definition; see the following image.
8.
Add wheel control coding into
if(RB_1 != 0) { }
See the following example.
if(RB_1 != 0) {wheel_active(3,512); Action(RB_1); wheel_active(9,0);}
else {Action(52);}
The wheel control function is
wheel_active (int Z, int W)
Z means direction (1 ~ 9) and W means speed (0 ~ 1023, 0 is stop).
Definition
Definition
Z = 1
Turn right in place
Z = 2
Turn right
Z = 3
Forward
Z = 4
Turn left
Z = 5
Turn left in place
Z = 6
Backward and turn left
Z = 7
Backward
Z = 8
Backward and turn right
Z = 9
Stop
NOTE:
•
Add “; (semicolon)” after each command.
•
Add
wheel_active(9,0);
to the end of the command. The wheels will not stop moving
unless this command is added.
•
If you need to extend the wheel moving time, add
delay(1000);
. 1000 could be any
number, and the unit is a millisecond.
•
Make sure the action definition in
OTHERS_USER_MOTION.h
is any number from 1~54.
The default button control is 0.
03
Operations