Arduino {code}racer API
... better know the details.
|
Functions | |
void | CodeRacer::stop_driving () |
Stops the racer and sets status LEDs. More... | |
void | CodeRacer::drive_forward () |
Sets the speed and the directions of both drives so that it will move forward. More... | |
void | CodeRacer::drive_forward (uint8_t left_speed, uint8_t right_speed) |
Sets the speed as specified for both drives and the directions of both drives so that it will move forward. More... | |
void | CodeRacer::drive_backward () |
Sets the speed and the directions of both drives so that it will move backward. More... | |
void | CodeRacer::drive_backward (uint8_t left_speed, uint8_t right_speed) |
Sets the speed as specified for both drives and the directions of both drives so that it will move backward. More... | |
void | CodeRacer::turn_left () |
Will turn the racer to the left for the internally stroe time in ms and with the internally stored speed. More... | |
void | CodeRacer::turn_left (unsigned long turn_for_ms) |
Will turn the racer to the left for the specified time in ms and with the internally stored speed. More... | |
void | CodeRacer::turn_left (unsigned long turn_for_ms, uint8_t left_speed, uint8_t right_speed) |
Will turn the racer to the left for the specified time in ms and with the specified speed. More... | |
void | CodeRacer::turn_right () |
Will turn the racer to the right for the internally stroe time in ms and with the internally stored speed. More... | |
void | CodeRacer::turn_right (unsigned long turn_for_ms) |
Will turn the racer to the right for the specified time in ms and with the internally stored speed. More... | |
void | CodeRacer::turn_right (unsigned long turn_for_ms, uint8_t left_speed, uint8_t right_speed) |
Will turn the racer to the right for the specified time in ms and with the specified speed. More... | |
void | CodeRacer::start_stop_at_min_distance () |
Enables to stopp the racer if during a distance measurement the measured distance is smaller then the internally stored minimal distance. More... | |
void | CodeRacer::start_stop_at_min_distance (unsigned long min_distance_cm) |
Enables to stopp the racer if during a distance measurement the measured distance is smaller then the specified minimal distance. More... | |
void | CodeRacer::stop_stop_at_min_distance () |
Disables to stopp the racer if during a distance measurement the measured distance is smaller then the specified minimal distance. More... | |
bool | CodeRacer::start_stop () |
This will return if the codracer is in active mode or not. More... | |
void CodeRacer::stop_driving | ( | ) |
void CodeRacer::drive_forward | ( | ) |
Sets the speed and the directions of both drives so that it will move forward.
The speed is taken from the header file or set by one of the methods defined in the lower level drive methods section
Definition at line 173 of file CodeRacer.cpp.
void CodeRacer::drive_forward | ( | uint8_t | left_speed, |
uint8_t | right_speed | ||
) |
Sets the speed as specified for both drives and the directions of both drives so that it will move forward.
The specified speed values for both drives will be stored internaly so next time if you use e.g. drive_forward() exactly the here specified values will be taken.
left_speed | speed for the left side drive. 0<=speed<=255 |
right_speed | speed for the right side drive. 0<=speed<=255 |
Definition at line 185 of file CodeRacer.cpp.
void CodeRacer::drive_backward | ( | ) |
Sets the speed and the directions of both drives so that it will move backward.
The speed is taken from the header file or set by one of the methods defined in the lower level drive methods section
Definition at line 199 of file CodeRacer.cpp.
void CodeRacer::drive_backward | ( | uint8_t | left_speed, |
uint8_t | right_speed | ||
) |
Sets the speed as specified for both drives and the directions of both drives so that it will move backward.
The specified speed values for both drives will be stored internaly so next time if you use e.g. drive_backward() exactly the here specified values will be taken.
left_speed | speed for the left side drive. 0<=speed<=255 |
right_speed | speed for the right side drive. 0<=speed<=255 |
Definition at line 211 of file CodeRacer.cpp.
void CodeRacer::turn_left | ( | ) |
Will turn the racer to the left for the internally stroe time in ms and with the internally stored speed.
The speed for both the left side and right side drive can be set by the methods described in the lower level drive section. The turn to left time can be set by thoose methods as well. The method is delayed until the racer has turned.
Definition at line 226 of file CodeRacer.cpp.
void CodeRacer::turn_left | ( | unsigned long | turn_for_ms | ) |
Will turn the racer to the left for the specified time in ms and with the internally stored speed.
The specified duration of time is stored internally and will be used next time by e.g. turn_left()
turn_for_ms | duration of time in ms to turn the racer |
Definition at line 237 of file CodeRacer.cpp.
void CodeRacer::turn_left | ( | unsigned long | turn_for_ms, |
uint8_t | left_speed, | ||
uint8_t | right_speed | ||
) |
Will turn the racer to the left for the specified time in ms and with the specified speed.
The specified duration of time and the specified speeds are stored internally and will be used next time by e.g. turn_left()
turn_for_ms | duration of time in ms to turn the racer |
left_speed | speed for the left side drive |
right_speed | speed for the right side drive |
Definition at line 250 of file CodeRacer.cpp.
void CodeRacer::turn_right | ( | ) |
Will turn the racer to the right for the internally stroe time in ms and with the internally stored speed.
The speed for both the left side and right side drive can be set by the methods described in the lower level drive section. The turn to right time can be set by thoose methods as well. The method is delayed until the racer has turned.
Definition at line 269 of file CodeRacer.cpp.
void CodeRacer::turn_right | ( | unsigned long | turn_for_ms | ) |
Will turn the racer to the right for the specified time in ms and with the internally stored speed.
The specified duration of time is stored internally and will be used next time by e.g. turn_right()
turn_for_ms | duration of time in ms to turn the racer |
Definition at line 280 of file CodeRacer.cpp.
void CodeRacer::turn_right | ( | unsigned long | turn_for_ms, |
uint8_t | left_speed, | ||
uint8_t | right_speed | ||
) |
Will turn the racer to the right for the specified time in ms and with the specified speed.
The specified duration of time and the specified speeds are stored internally and will be used next time by e.g. turn_right()
turn_for_ms | duration of time in ms to turn the racer |
left_speed | speed for the left side drive |
right_speed | speed for the right side drive |
Definition at line 293 of file CodeRacer.cpp.
void CodeRacer::start_stop_at_min_distance | ( | ) |
Enables to stopp the racer if during a distance measurement the measured distance is smaller then the internally stored minimal distance.
This allow all of the none-single shot ultra sonic measurement methods to stopp the racer in the case the measured distance is smaller than minimal distance. This is just the enablement - you have to call one of the none-single-shot ultra sonic measurement methods continously while driving and maybe sweeping the servo. If the racer was stopped can be checked with stopped_at_min_distance() - it will return true in that case. The minimal distance can be set by the ultrasonic sensor setter methods. There is an example coming with the coderacer libary that you can load and get an idea how that works.
Definition at line 314 of file CodeRacer.cpp.
void CodeRacer::start_stop_at_min_distance | ( | unsigned long | min_distance_cm | ) |
Enables to stopp the racer if during a distance measurement the measured distance is smaller then the specified minimal distance.
This is almos the same as described for start_stop_at_min_distance(). You can specify the distance in cm here - this value will be stored internally and used by start_stop_at_min_distance() next time.
min_distance_cm | the minimal disctance in cm |
Definition at line 324 of file CodeRacer.cpp.
void CodeRacer::stop_stop_at_min_distance | ( | ) |
Disables to stopp the racer if during a distance measurement the measured distance is smaller then the specified minimal distance.
Definition at line 335 of file CodeRacer.cpp.
bool CodeRacer::start_stop | ( | ) |
This will return if the codracer is in active mode or not.
There is a button used to toogle between active and inactive each time it is pressed This may help you to start driving and scanning the distance by pressing the button - and as well to stop the racer by pressing the button. This method will set the LEDs depending on the mode and sets the servo back to center and stopps the racer when leaving the active mode. You can leave or enter the active mode as well by setting using set_active() and set_inactive(). The button itself triggers and internall interrupt event and sets the active state - but you have to continously call that method to switch between inactive and active mode depending on the active state. If in inactive mode and fun is enabeld by just setting the coderacer_fun_enabled = true ... some fun will happen :-)
Definition at line 348 of file CodeRacer.cpp.