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

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

Detailed Description

Bluetooth BLE class. Handles communicating with the bluetooth module, uses ArduinoBlue data tags.

Constructor & Destructor Documentation

◆ bluetooth() [1/2]

bluetooth::bluetooth ( int  rx,
int  tx 
)

Basic Bluetooth constructor. Sets the pins for communication with the BLE module and starts the stream to communicate.

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

◆ bluetooth() [2/2]

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

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

◆ getButton()

int bluetooth::getButton ( )

Call function for the last button id recieved.

Returns
integer button id, expected between 0 and 200.

◆ getDirection()

float bluetooth::getDirection ( )

Call function for the last direction recieved.

Returns
float direction, between 0 and 6.28 (2PI).

◆ getModeButton()

bool bluetooth::getModeButton ( )

Call function for the current mode status, inverts when the mode button id (2) is recieved.

Returns
boolean status of mode on or off.

◆ getSlider()

int bluetooth::getSlider ( )

Call function for the last slider id recieved.

Returns
integer slider id, expected between 0 and 200..

◆ getSliderValue()

int bluetooth::getSliderValue ( )

Call function for the last slider value recieved.

Returns
integer slider value, expected between 0 and 200.

◆ getSpeed()

int bluetooth::getSpeed ( )

Call function for sthe last speed recieved.

Returns
integer speed, between 0 and 100.

◆ getText()

String bluetooth::getText ( )

Call function for the last text recieved.

Returns
String text.

◆ processData()

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.

◆ setup()

void bluetooth::setup ( )

Checks that the module is responding and attempts to rename it if a name was given during construction.


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