#include <MOREbot.h>
|
| MOREbot (int LM, int RM) |
|
| MOREbot (String name, int LM, int RM) |
|
| MOREbot (int LM, int RM, int trig, int echo) |
|
| MOREbot (String name, int LM, int RM, int trig, int echo) |
|
| MOREbot (String name, int LM, int RM, int trig, int echo, int rx, int tx) |
|
void | setup () |
|
motor | getLeftMotor () |
|
motor | getRightMotor () |
|
ultrasonic | getUltrasonic () |
|
bluetooth | getBluetooth () |
|
void | forward (int speed) |
|
void | backward (int speed) |
|
void | left (int speed) |
|
void | right (int speed) |
|
void | stop () |
|
float | readDistance () |
|
void | btControl () |
|
void | bounce (float targetDistance, float threshold) |
|
◆ MOREbot() [1/5]
MOREbot::MOREbot |
( |
int |
LM, |
|
|
int |
RM |
|
) |
| |
Two motor MOREbot constructor. Creates left and right motor objects to control the motors.
- Parameters
-
LM | an integer. Port of the left motor. |
RM | an integer. Port of the right motor. |
◆ MOREbot() [2/5]
MOREbot::MOREbot |
( |
String |
name, |
|
|
int |
LM, |
|
|
int |
RM |
|
) |
| |
Two motor MOREbot constructor. Creates left and right motor objects to control the motors.
- Parameters
-
name | a String. The name of the robot. |
LM | an integer. Port of the left motor. |
RM | an integer. Port of the right motor. |
◆ MOREbot() [3/5]
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.
- Parameters
-
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() [4/5]
MOREbot::MOREbot |
( |
String |
name, |
|
|
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.
- Parameters
-
name | a String. The name of the robot. |
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() [5/5]
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.
- Parameters
-
name | a String. The name of the robot. |
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. |
◆ backward()
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.
- Parameters
-
speed | an integer, constrained between -100 and 100. |
◆ bounce()
void MOREbot::bounce |
( |
float |
targetDistance, |
|
|
float |
threshold |
|
) |
| |
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().
- Parameters
-
targetDistance | a float. Distance the MOREbot attempts to maintain. |
threshold | a float. The distance from the target that the MOREbot will accept as close enough. |
◆ 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().
◆ forward()
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.
- Parameters
-
speed | an integer, constrained between -100 and 100. |
◆ getBluetooth()
Call function for the bluetooth object.
- Returns
- bluetooth object.
- See also
- bluetooth
◆ getLeftMotor()
motor MOREbot::getLeftMotor |
( |
| ) |
|
Call function for the left motor motor object.
- Returns
- motor object, the object for the left motor port on the motor shield.
- See also
- motor
◆ getRightMotor()
motor MOREbot::getRightMotor |
( |
| ) |
|
Call function for the right motor motor object.
- Returns
- motor object, the object for the right motor port on the motor shield.
- See also
- motor
◆ getUltrasonic()
Call function for the ultrasonic object.
- Returns
- ultrasonic object.
- See also
- ultrasonic
◆ left()
void MOREbot::left |
( |
int |
speed | ) |
|
Drive function for MOREbot to drive left. Commands the both motors counterclockwise at the given speed.
- Parameters
-
speed | an integer, constrained between -100 and 100. |
◆ readDistance()
float MOREbot::readDistance |
( |
| ) |
|
Distance sensing function. Calls ultasonic.readDistance() to get distance to the closest object in centimeters.
- Returns
- float distance to closest object in centimeters.
◆ right()
void MOREbot::right |
( |
int |
speed | ) |
|
Drive function for MOREbot to drive right. Commands the both motors clockwise at the given speed.
- Parameters
-
speed | an integer, constrained between -100 and 100. |
◆ setup()
Robot setup. Starts the motor shield i2c and bluetooth UART communication streams.
◆ stop()
Drive function for MOREbot to stop. Commands the both motors to stop.
The documentation for this class was generated from the following files: