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.
wallbotble Class Reference
wallbot ble control class More...
#include <wallbotble.h>
Public Member Functions | |
wallbotble () | |
Create the wallbot object connected to the default pins. | |
void | set_f_sensor_gain (int gain) |
Set Sensor gain. | |
void | f_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_turn (float speed) |
Drive left motor backwards and right motor forwards at the same speed to turn on the spot. | |
void | right_turn (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 . | |
void | set_led1 (int bit) |
Set led1 . | |
void | set_led2 (int bit) |
Set led2 . |
Detailed Description
wallbot ble control class
Example:
// Drive the wwallbot forward, turn left, back, turn right, at half speed for half a second #include "mbed.h" #include "wallbotble.h" wallbotble 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 wallbotble.h.
Constructor & Destructor Documentation
wallbotble | ( | ) |
Create the wallbot object connected to the default pins.
Definition at line 30 of file wallbotble.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 wallbotble.cpp.
void f_sensor_calibrate | ( | void | ) |
Sensor calibrate.
Definition at line 112 of file wallbotble.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 wallbotble.cpp.
int GetLinePosition | ( | void | ) |
int GetSw | ( | void | ) |
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 wallbotble.cpp.
void left_turn | ( | 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 wallbotble.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 wallbotble.cpp.
void right_turn | ( | 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 wallbotble.cpp.
void set_f_sensor_gain | ( | int | gain ) |
void set_led | ( | int | bit ) |
Set status led .
- Parameters:
-
led (bit0:LEFT bit2:RIGHT)
Definition at line 75 of file wallbotble.cpp.
void set_led1 | ( | int | bit ) |
void set_led2 | ( | int | bit ) |
void stop | ( | void | ) |
Stop both motors.
Definition at line 70 of file wallbotble.cpp.
Generated on Tue Jul 12 2022 20:04:45 by
