![]() |
MOREbot_Library
1.3.2
Library to control the MOREbot base robot
|
#include <MOREbot.h>
Public Member Functions | |
bluetooth (int rx, int tx) | |
bluetooth (String name, int rx, int tx) | |
void | setup () |
void | processData () |
bool | getModeButton () |
int | getSpeed () |
float | getDirection () |
int | getButton () |
int | getSlider () |
int | getSliderValue () |
String | getText () |
Bluetooth BLE class. Handles communicating with the bluetooth module, uses ArduinoBlue data tags.
bluetooth::bluetooth | ( | int | rx, |
int | tx | ||
) |
Basic Bluetooth constructor. Sets the pins for communication with the BLE module and starts the stream to communicate.
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. |
bluetooth::bluetooth | ( | String | name, |
int | rx, | ||
int | tx | ||
) |
Bluetooth constructor eith renaming. Sets the pins for communication with the BLE module and starts the stream to communicate. Saves name to be used when renaming the module during setup().
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) |
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. |
int bluetooth::getButton | ( | ) |
Call function for the last button id recieved.
float bluetooth::getDirection | ( | ) |
Call function for the last direction recieved.
2PI
). bool bluetooth::getModeButton | ( | ) |
Call function for the current mode status, inverts when the mode button id (2) is recieved.
int bluetooth::getSlider | ( | ) |
Call function for the last slider id recieved.
int bluetooth::getSliderValue | ( | ) |
Call function for the last slider value recieved.
int bluetooth::getSpeed | ( | ) |
Call function for sthe last speed recieved.
String bluetooth::getText | ( | ) |
Call function for the last text recieved.
void bluetooth::processData | ( | ) |
Reads the BLE stream for any data that the module has recieved. Saves that data in private memory. Processes joystick data from radial coordinates into speed and direction.
void bluetooth::setup | ( | ) |
Checks that the module is responding and attempts to rename it if a name was given during construction.