It is a library for controlling Wallbot mini
wallbotmini Class Reference
wallbot mini control class More...
#include <wallbotmini.h>
Public Member Functions | |
wallbotmini () | |
Create the wallbot object connected to the default pins. | |
void | sensor_calibrate (void) |
Sensor calibrate. | |
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. | |
int | GetLinePosition (void) |
Get floorline position. | |
int | GetSw (void) |
Get switch . | |
void | set_led (int bit) |
Set status led . |
Detailed Description
wallbot mini control class
Example:
// Drive the wwallbot forward, turn left, back, turn right, at half speed for half a second #include "mbed.h" #include "wallbotmini.h" wallbotmini wb; int main() { wb.sensor_calibrate(); while(!wb.GetSw()) { wb.set_led(wb.GetLinePosition()); } wb.forward(1.0); wait (1.0); wb.left(1.0); wait (1.0); wb.backward(1.0); wait (1.0); wb.right(1.0); wait (1.0); wb.stop(); while(1); }
Definition at line 71 of file wallbotmini.h.
Constructor & Destructor Documentation
wallbotmini | ( | ) |
Create the wallbot object connected to the default pins.
Definition at line 30 of file wallbotmini.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 51 of file wallbotmini.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 46 of file wallbotmini.cpp.
int GetLinePosition | ( | void | ) |
int GetSw | ( | 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 56 of file wallbotmini.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 38 of file wallbotmini.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 61 of file wallbotmini.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 42 of file wallbotmini.cpp.
void sensor_calibrate | ( | void | ) |
Sensor calibrate.
Definition at line 75 of file wallbotmini.cpp.
void set_led | ( | int | bit ) |
Set status led .
- Parameters:
-
led (bit0:LEFT bit1:UP bit2:RIGHT bit3 DOWN)
Definition at line 71 of file wallbotmini.cpp.
void stop | ( | void | ) |
Stop both motors.
Definition at line 66 of file wallbotmini.cpp.
Generated on Sun Jul 17 2022 18:15:08 by 1.7.2