4. USAGE
Kilobot User Manual
27
4.3.7 Kilobots API
The different functions specially developed for the Kilobots are explained below. Numerous
other functions and AVR-C programming examples can be found on the web.
You can also found more documentation on the Kilobotics website
(
https://www.kilobotics.com/docs/index.html
) where the whole set of functions are explained.
Only the main function are explained below.
•
Kilo_init()
Initialize Kilobot hardware.
•
set_motors(cw_motor,ccw_motor)
Set motor speed PWM values for motors between 0 (off) and 255 (full on) for cw_motor
and ccw_motor
Examples:
-
for moving forward: set_motors(kilo_straight_left, kilo_straight_right);
-
for turning left: set_motors(kilo_turn_left, 0);
-
for turning right: set_motors(0, c kilo_turn_right);
Note that there are 4 calibration values used with the motors
kilo_turn_left: value for left motor to turn the robot ccw in place (note: right motor
should be off)
kilo_turn_right: value for right motor to turn the robot cw in place (note: left motor
should be off)
kilo_straight_left: value for the left motor to move the robot in the forward direction
kilo_straight_right: value for the right motor to move the robot in the forward
direction
•
delay(x)
Busy wait for x milliseconds, interrupts can still trigger
Example:
delay(250);
•
estimate_distance (x)
Estimate distance in mm based on signal strength measurements.
Example:
distance = estimate_distance(distance_measurement);
•
set_color(r,g,b)
Set LED color, values can be from 0(off)-3(brightest)
Example:
set_color(1,1,1);
Summary of Contents for KILOBOT
Page 1: ...Kilobot User manual Version 2 0 JANUARY 2016 ...
Page 4: ......
Page 42: ......
Page 43: ......
Page 44: ...K Team S A Z I Plans Praz 1337 Vallorbe Switzerland ...