![]() |
MOREbot Library
v1.1.1
|
Bluetooth BLE class. More...
#include <MOREbot.h>
Public Member Functions | |
bluetooth (int rx, int tx) | |
Basic Bluetooth constructor. More... | |
bluetooth (String name, int rx, int tx) | |
Bluetooth constructor eith renaming. More... | |
void | setup () |
Checks that the module is responding and attempts to rename it if a name was given during construction. More... | |
void | processData () |
Reads the BLE stream for any data that the module has recieved. More... | |
bool | getModeButton () |
Call function for the current mode status, inverts when the mode button id (2) is recieved. More... | |
int | getSpeed () |
Call function for sthe last speed recieved. More... | |
float | getDirection () |
Call function for the last direction recieved. More... | |
int | getButton () |
Call function for the last button id recieved. More... | |
int | getSlider () |
Call function for the last slider id recieved. More... | |
int | getSliderValue () |
Call function for the last slider value recieved. More... | |
String | getText () |
Call function for the last text recieved. More... | |
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 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.