Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: CustomExplorerRobot_test
CustomExplorerRobot Class Reference
CustomExplorerRobot control class. More...
#include <CustomExplorerRobot.h>
Public Member Functions | |
| CustomExplorerRobot () | |
| Create the CustomExplorerRobot object connected to the default pins. | |
| void | left_motor (float speed) |
| Directly control the speed and direction of the left motor. | |
| void | right_motor (float speed) |
| Directly control the speed and direction of the right motor. | |
| void | forward (float speed) |
| Drive both motors forward as the same speed. | |
| void | backward (float speed) |
| Drive both motors backward as the same speed. | |
| void | left (float speed) |
| Drive left motor backwards and right motor forwards at the same speed to turn on the spot. | |
| void | right (float speed) |
| Drive left motor forward and right motor backwards at the same speed to turn on the spot. | |
| void | stop (void) |
| Stop both motors. | |
Detailed Description
CustomExplorerRobot control class.
Example:
// Drive the CustomExplorerRobot forward, turn left, back, turn right, at half speed for half a second #include "mbed.h" #include "CustomExplorerRobot.h" CustomExplorerRobot cer; int main() { wait(0.5f); cer.forward(0.5f); wait(0.5f); cer.left(0.5f); wait(0.5f); cer.backward(0.5f); wait(0.5f); cer.right(0.5f); wait(0.5f); cer.stop(); return 0; }
Definition at line 60 of file CustomExplorerRobot.h.
Constructor & Destructor Documentation
Create the CustomExplorerRobot object connected to the default pins.
Definition at line 29 of file CustomExplorerRobot.cpp.
Member Function Documentation
| void backward | ( | float | speed ) |
Drive both motors backward as the same speed.
- Parameters:
-
speed A normalised number 0 - 1.0 represents the full range.
Definition at line 50 of file CustomExplorerRobot.cpp.
| void forward | ( | float | speed ) |
Drive both motors forward as the same speed.
- Parameters:
-
speed A normalised number 0 - 1.0 represents the full range.
Definition at line 45 of file CustomExplorerRobot.cpp.
| void left | ( | float | speed ) |
Drive left motor backwards and right motor forwards at the same speed to turn on the spot.
- Parameters:
-
speed A normalised number 0 - 1.0 represents the full range.
Definition at line 55 of file CustomExplorerRobot.cpp.
| void left_motor | ( | float | speed ) |
Directly control the speed and direction of the left motor.
- Parameters:
-
speed A normalised number -1.0 - 1.0 represents the full range.
Definition at line 37 of file CustomExplorerRobot.cpp.
| void right | ( | float | speed ) |
Drive left motor forward and right motor backwards at the same speed to turn on the spot.
- Parameters:
-
speed A normalised number 0 - 1.0 represents the full range.
Definition at line 60 of file CustomExplorerRobot.cpp.
| void right_motor | ( | float | speed ) |
Directly control the speed and direction of the right motor.
- Parameters:
-
speed A normalised number -1.0 - 1.0 represents the full range.
Definition at line 41 of file CustomExplorerRobot.cpp.
| void stop | ( | void | ) |
Stop both motors.
Definition at line 65 of file CustomExplorerRobot.cpp.
Generated on Tue Jul 19 2022 20:04:29 by
1.7.2
Custom Explorer Robot