MOREbot_Library  1.3.2
Library to control the MOREbot base robot
Public Member Functions | List of all members
MOREbot Class Reference

#include <MOREbot.h>

Public Member Functions

 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)
 

Constructor & Destructor Documentation

◆ MOREbot() [1/5]

MOREbot::MOREbot ( int  LM,
int  RM 
)

Two motor MOREbot constructor. Creates left and right motor objects to control the motors.

Parameters
LMan integer. Port of the left motor.
RMan 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
namea String. The name of the robot.
LMan integer. Port of the left motor.
RMan 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
LMan integer. Port of the left motor.
RMan integer. Port of the right motor.
trigan integer. The pin on the arduino that the ultrasonic's trig pin is connected to.
echoan 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
namea String. The name of the robot.
LMan integer. Port of the left motor.
RMan integer. Port of the right motor.
trigan integer. The pin on the arduino that the ultrasonic's trig pin is connected to.
echoan 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
namea String. The name of the robot.
LMan integer. Port of the left motor.
RMan integer. Port of the right motor.
trigan integer. The pin on the arduino that the ultrasonic's trig pin is connected to.
echoan integer. The pin on the arduino that the ultrasonic's echo pin is connected to.
rxan integer. Read pin for the arduino, connects to tx on the BLE module.
txan integer. Send pin for the arduino, connects to rx on the BLE.

Member Function Documentation

◆ 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
speedan 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
targetDistancea float. Distance the MOREbot attempts to maintain.
thresholda 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
speedan integer, constrained between -100 and 100.

◆ getBluetooth()

bluetooth MOREbot::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()

ultrasonic MOREbot::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
speedan 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
speedan integer, constrained between -100 and 100.

◆ setup()

void MOREbot::setup ( )

Robot setup. Starts the motor shield i2c and bluetooth UART communication streams.

◆ stop()

void MOREbot::stop ( )

Drive function for MOREbot to stop. Commands the both motors to stop.


The documentation for this class was generated from the following files: