![]() |
MOREbot Library
v1.1.1
|
Public Member Functions | |
MOREbot (int LM, int RM) | |
Two motor MOREbot constructor. More... | |
MOREbot (int LM, int RM, int trig, int echo) | |
Two motor and ultrasonic MOREbot constructor. More... | |
MOREbot (String name, int LM, int RM, int trig, int echo, int rx, int tx) | |
Two motor and ultrasonic MOREbot constructor. More... | |
void | setup () |
Robot setup. More... | |
motor | getLeftMotor () |
Call function for the left motor motor object. More... | |
motor | getRightMotor () |
Call function for the right motor motor object. More... | |
ultrasonic | getUltrasonic () |
Call function for the ultrasonic object. More... | |
bluetooth | getBluetooth () |
Call function for the bluetooth object. More... | |
void | forward (int speed) |
Drive function for MOREbot to drive forward. More... | |
void | backward (int speed) |
Drive function for MOREbot to drive backward. More... | |
void | left (int speed) |
Drive function for MOREbot to drive left. More... | |
void | right (int speed) |
Drive function for MOREbot to drive right. More... | |
void | stop () |
Drive function for MOREbot to stop. More... | |
float | readDistance () |
Distance sensing function. More... | |
void | btControl () |
Operation function for full control from a BLE connection. More... | |
void | bounce () |
Operation function for full control to maintain distance to object in front. More... | |
MOREbot::MOREbot | ( | int | LM, |
int | RM | ||
) |
Two motor MOREbot constructor.
Creates left and right motor objects to control the motors.
LM | an integer. Port of the left motor. |
RM | an integer. Port of the right motor. |
MOREbot::MOREbot | ( | int | LM, |
int | RM, | ||
int | trig, | ||
int | echo | ||
) |
Two motor and ultrasonic MOREbot constructor.
Creates left and right motor objects to control the motors and an ultrasonic object to sense distance.
LM | an integer. Port of the left motor. |
RM | an integer. Port of the right motor. |
trig | an integer. The pin on the arduino that the ultrasonic's trig pin is connected to. |
echo | an integer. The pin on the arduino that the ultrasonic's echo pin is connected to. |
MOREbot::MOREbot | ( | String | name, |
int | LM, | ||
int | RM, | ||
int | trig, | ||
int | echo, | ||
int | rx, | ||
int | tx | ||
) |
Two motor and ultrasonic MOREbot constructor.
Creates left and right motor objects to control the motors and an ultrasonic object to sense distance.
name | a String. The name that the arduino will attempt to rename the BLE before starting data communication (Does not rename if the module is already connected) |
LM | an integer. Port of the left motor. |
RM | an integer. Port of the right motor. |
trig | an integer. The pin on the arduino that the ultrasonic's trig pin is connected to. |
echo | an integer. The pin on the arduino that the ultrasonic's echo pin is connected to. |
rx | an integer. Read pin for the arduino, connects to tx on the BLE module. |
tx | an integer. Send pin for the arduino, connects to rx on the BLE. |
void MOREbot::backward | ( | int | speed | ) |
Drive function for MOREbot to drive backward.
Commands the left motor counterclockwise and the right motor clockwise at the given speed.
speed | an integer, constrained between -100 and 100. |
void MOREbot::bounce | ( | ) |
Operation function for full control to maintain distance to object in front.
Handles full control of the robot through the ultrasonic's distance value, if bluetooth is connected, ArduinoBlue button id 2 changes to btControl().
void MOREbot::btControl | ( | ) |
Operation function for full control from a BLE connection.
Handles full control of the robot through the bluetooth module expecting ArduinoBlue joystick values, button id 2 changes to bounce().
void MOREbot::forward | ( | int | speed | ) |
Drive function for MOREbot to drive forward.
Commands the left motor clockwise and the right motor counterclockwise at the given speed.
speed | an integer, constrained between -100 and 100. |
bluetooth MOREbot::getBluetooth | ( | ) |
motor MOREbot::getLeftMotor | ( | ) |
Call function for the left motor motor object.
motor MOREbot::getRightMotor | ( | ) |
Call function for the right motor motor object.
ultrasonic MOREbot::getUltrasonic | ( | ) |
void MOREbot::left | ( | int | speed | ) |
Drive function for MOREbot to drive left.
Commands the both motors counterclockwise at the given speed.
speed | an integer, constrained between -100 and 100. |
float MOREbot::readDistance | ( | ) |
Distance sensing function.
Calls ultasonic.readDistance() to get distance to the closest object in centimeters.
void MOREbot::right | ( | int | speed | ) |
Drive function for MOREbot to drive right.
Commands the both motors clockwise at the given speed.
speed | an integer, constrained between -100 and 100. |
void MOREbot::setup | ( | ) |
Robot setup.
Starts the motor shield i2c and bluetooth UART communication streams.
void MOREbot::stop | ( | ) |
Drive function for MOREbot to stop.
Commands the both motors to stop.