MOREbot Library  v1.1.1
Public Member Functions | List of all members
MOREbot Class Reference

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...
 

Constructor & Destructor Documentation

◆ MOREbot() [1/3]

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/3]

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() [3/3]

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 that the arduino will attempt to rename the BLE before starting data communication (Does not rename if the module is already connected)
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 ( )

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().

◆ 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: