Page 30
Sample color tracking program controlling a servo motor
This sample program is a demo for using the camera on the KIPR Link to control a servo motor. If you
don't have a servo motor, skip to the next example. Servo motors come with "horns" designed to fit on
the motor shaft. Choose one that will serve as a pointing device and attach it to your servo. The action
of this program is to turn the servo in response to an object on color Channel 0, in effect rotating the
servo to continue to point at the object as it is moved back and forth in front of the camera
Set Up
Attach the camera to your KIPR Link and plug your servo into servo port 0. You need to set the color
model on Channel 0 to track an object you can move in front of the camera (usually the more saturated
with color the better). The servo needs to be pointed so that when at its midpoint position (1024) it
points at the center of the camera’s field of view.
Motors can be directly manipulated from the KIPR Link interface, which for servos provides a means for
determining position settings to use in a program. In this case, we only need to orient the servo. From
the Home Screen press the
Motors and Sensors
button to bring up the device selection screen from
which if you select
Servos
you will get the servo test screen. Press
Port 0
, enter 1024, and press
Enable
to position the servo.
Press
Back
to return to the device selection screen (first press if you want to turn the servo off). This
time press
Camera
to get the camera view on the screen so you can align the servo to be pointing at the
center of the camera's field of view. For a better effect, you might want to attach a pointer to the servo
horn (of a different color than for your color model).
You are now ready to run the program below. Reminder: Use the KISS IDE
Compile
button to test the
program before downloading and running it on your KIPR Link.
Содержание KIPR Link
Страница 1: ...KIPR Link Manual Version BB2014 1 1...