It is a library for controlling Wallbot
wallbot Class Reference
wallbot control class More...
#include <wallbot.h>
Public Member Functions | |
wallbot () | |
Create the wallbot 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. | |
float | GetLinePosition (void) |
Get floorline position. | |
void | GetLinePosition (int *bit) |
Get floorline position. | |
int | GetLeftSw (void) |
Get left switch . | |
int | GetRightSw (void) |
Get GetRightSw switch . |
Detailed Description
wallbot control class
Example:
// Drive the wwallbot forward, turn left, back, turn right, at half speed for half a second #include "mbed.h" #include "wallbot.h" wallbot wb; int main() { wait(0.5); wb.forward(0.5); wait (0.5); wb.left(0.5); wait (0.5); wb.backward(0.5); wait (0.5); wb.right(0.5); wait (0.5); wb.stop(); }
Definition at line 66 of file wallbot.h.
Constructor & Destructor Documentation
wallbot | ( | ) |
Create the wallbot object connected to the default pins.
Definition at line 30 of file wallbot.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 55 of file wallbot.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 50 of file wallbot.cpp.
int GetLeftSw | ( | void | ) |
float GetLinePosition | ( | void | ) |
void GetLinePosition | ( | int * | bit ) |
int GetRightSw | ( | void | ) |
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 60 of file wallbot.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 42 of file wallbot.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 65 of file wallbot.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 46 of file wallbot.cpp.
void stop | ( | void | ) |
Stop both motors.
Definition at line 70 of file wallbot.cpp.
Generated on Sun Jul 17 2022 09:53:56 by 1.7.2