RobotUI Code Reference

This guide assumes you have already performed the setup and the development guide

Methods by Class

Methods Alphabetical

Add

void RobotUI::Add(RobotUIWidget& widget, int weight, TextSize textSize, int justification)
This is the method of RobotUI that allows you to add widgets to the layout definition. Please refer to the LayoutDef tutorial or the Widgets tutorial.

RobotUIWidget& widget : A reference to the widget to be added to the UI layout
int weight : The size weight of this widget compared to the other widgets in this group
TextSize textSize : The size of the font used for the text in this widget (if applicable)
int justification : The justification code for the text in this widget (if applicable). Codes are JUSTIFY_TOP_LEFT, JUSTIFY_TOP, JUSTIFY_TOP_RIGHT, JUSTIFY_LEFT, JUSTIFY_CENTRE, JUSTIFY_RIGHT, JUSTIFY_BOTTOM_LEFT, JUSTIFY_BOTTOM, JUSTIFY_BOTTOM_RIGHT


See also, AddLabel , AddSpace , RobotUI ,

AddLabel

void RobotUI::AddLabel(const char* text, int weight, TextSize textSize, int justification)
This is the method of RobotUI that allows you to add a label to the layout definition. Please refer to the LayoutDef example.

const char* text : A pointer to a string literal that contains the text for the label to be added to the UI layout
int weight : The size weight of this label compared to the other widgets in this group
TextSize textSize : The size of the font used for the text in this label
int justification : The justification code for the text in this label. Codes are JUSTIFY_TOP_LEFT, JUSTIFY_TOP, JUSTIFY_TOP_RIGHT, JUSTIFY_LEFT, JUSTIFY_CENTRE, JUSTIFY_RIGHT, JUSTIFY_BOTTOM_LEFT, JUSTIFY_BOTTOM, JUSTIFY_BOTTOM_RIGHT


See also, Add , AddSpace , RobotUI ,

AddSpace

void RobotUI::AddSpace(int weight)
This is the method of RobotUI that allows you to add a space to the layout definition. Please refer to the LayoutDef example.

int weight : The size weight of this label compared to the other widgets in this group


See also, Add , AddLabel , RobotUI ,

AppendText

void RobotUIText::AppendText(const char* newText)
This is the method of RobotUIText that allows you to append more text to the end of the widget. Please refer to the Runtime UI update example.

const char* newText : The new text that should be appended to this text widget


See also, SetText , RobotUIText ,

ConsumeHasChanged

void ConsumeHasChanged();
This is the method of RobotUICheckBox, RobotUISeekBar, RobotUISpinner, RobotUISwitch and RobotUIToggleButton, that signals to consume one event. After calling this, HasChanged() will no longer return true until there are more events that are sent from the RobotUI app. Please refer to the Runtime UI update example.

See also, ConsumeIsPressed , HasChanged , IsPressed , RobotUICheckBox , RobotUISeekBar , RobotUISpinner , RobotUISwitch , RobotUIToggleButton ,

ConsumeIsPressed

void RobotUIButton::ConsumeIsPressed()
This is the method of RobotUIButton that signals to consume one event. After calling this, IsPressed() will no longer return true until there are more events that are sent from the RobotUI app. Please refer to the Runtime UI update example.

See also, ConsumeHasChanged , HasChanged , IsPressed , RobotUIButton ,

EndHorizontal

void RobotUI::EndHorizontal()
This is a method of RobotUI used in the LayoutDef function. It ends a section of widgets that are to be displayed in a horizontal pattern. Please refer to the LayoutDef example.

See also, EndHorizontalScroll , EndLayout , EndVertical , EndVerticalScroll , StartHorizontal , StartHorizontalScroll, StartLayout , StartVertical , StartVerticalScroll , RobotUI ,

EndHorizontalScroll

void RobotUI::EndHorizontalScroll()
This is a method of RobotUI used in the LayoutDef function. It ends a section of widgets that are to be horizontally scrollable. Please refer to the LayoutDef example.

See also, EndHorizontal , EndLayout , EndVertical , EndVerticalScroll , StartHorizontal , StartHorizontalScroll, StartLayout , StartVertical , StartVerticalScroll , RobotUI ,

EndLayout

void RobotUI::EndLayout()
This is a method of RobotUI used in the LayoutDef function. It is the final call to signify the end of the layout definition. Please refer to the LayoutDef example.

See also, EndHorizontal , EndHorizontalScroll , EndVertical , EndVerticalScroll , StartHorizontal , StartHorizontalScroll, StartLayout , StartVertical , StartVerticalScroll , RobotUI ,

EndVertical

void RobotUI::EndVertical()
This is a method of RobotUI used in the LayoutDef function. It ends a section of widgets that are to be displayed in a vertical pattern. Please refer to the LayoutDef example.

See also, EndHorizontal , EndHorizontalScroll , EndLayout , EndVerticalScroll , StartHorizontal , StartHorizontalScroll, StartLayout , StartVertical , StartVerticalScroll , RobotUI ,

EndVerticalScroll

void RobotUI::EndVerticalScroll()
This is a method of RobotUI used in the LayoutDef function. It ends a section of widgets that are to be vertically scrollable. Please refer to the LayoutDef example.

See also, EndHorizontal , EndHorizontalScroll , EndLayout , EndVertical , StartHorizontal , StartHorizontalScroll, StartLayout , StartVertical , StartVerticalScroll , RobotUI ,

GetMax

char RobotUISeekBar::GetMax()
This is the method of RobotUISeekBar that will return the maximum value for the seek bar, set during construction. Please refer to the Using Widgets example.

See also, ConsumeHasChanged , GetProgress , HasChanged , RobotUISeekBar

GetOption

char RobotUISpinner::GetOption()
This is the method of RobotUISpinner that will return the currently selected option for the associated spinner widget, set by the RobotUI app user. Please refer to the Using Widgets example.

See also, ConsumeHasChanged , HasChanged , RobotUISpinner ,

GetProgress

char RobotUISeekBar::GetProgress()
This is the method of RobotUISeekBar that will return the currently selected progress for the associated seek bar widget, set by the RobotUI app user. Please refer to the Using Widgets example.

See also, ConsumeHasChanged , GetMax , HasChanged , RobotUISeekBar

HasChanged

bool HasChanged();
This is the method of RobotUICheckBox, RobotUISeekBar, RobotUISpinner, RobotUISwitch and RobotUIToggleButton, that signals whether the RobotUI app user has changed any of the associated widgets. This will return true until a call to ConsumeHasChanged() is made. Please refer to the Runtime UI update example.

See also, ConsumeHasChanged , ConsumeIsPressed , IsPressed , RobotUICheckBox , RobotUISeekBar , RobotUISpinner , RobotUISwitch , RobotUIToggleButton ,

Init

void RobotUI::Init(unsigned char pin_rx, unsigned char pin_tx, long int baudRate, int commandBufferSize, LayoutDefFunc layoutDefFunc, RecoverFunc recoverFunc) example call... robotUI.Init( ROBOTUI_PIN_RX, ROBOTUI_PIN_TX, BT_BAUDRATE, DEFAULT_COMMAND_BUFFER_SIZE, LayoutDef, RecoverStatus);
This is the initialization method of the RobotUI class and must be called before any other RobotUI method, typically it would be in the Arduino setup() function. An example can be found in the development guide

unsigned char pin_rx : Which pin the RobotUI should use for the RX, which is connected to the RX pin of the HC-06 module.
unsigned char pin_tx : Which pin the RobotUI should use for the TX, which is connected to the TX pin of the HC-06 module.
long int baudRate : The baudrate that your HC-06 module is set to. The default is 9600.
int commandBufferSize : The size of the command buffer, you may need to increase this if the comms traffic between your Arduino project and the RobotUI app is higher than usual
LayoutDefFunc layoutDefFunc : The name of your function that contains the layout definition. All of the examples use LayoutDef as the function name. Whatever function name you decide upon will have to be specified here.
RecoverFunc recoverFunc : The name of your function that contains the status recovery code. All of the examples use RecoverStatus as the function name. Whatever function name you decide upon will have to be specified here.


See also, RobotUI ,

IsPressed

bool IsPressed();
This is the method of RobotUIButton, RobotUICheckBox, RobotUISwitch and RobotUIToggleButton, that returns true when the RobotUI app user is pressing the associated widget. The RobotUIButton's IsPressed will return true until a call to ConsumeIsPressed() is made. Please refer to the Runtime UI update example.

See also, ConsumeHasChanged , ConsumeIsPressed , HasChanged , RobotUIButton , RobotUICheckBox , RobotUISwitch , RobotUIToggleButton ,

SetIsEnabled

void RobotUIButton::SetIsEnabled(bool enabled)
This is the method of RobotUIButton that allows you to enable and disable the associated button widget in the RobotUI app. The button will appear grayed out when disabled to indicate to the user that it is not active. Please refer to the Runtime UI update example.

bool enabled : Whether or not you want the associated button in the RobotUI app to be enabled or disabled. Send True/False for enabled/disabled.


See also, SetIsPressed , SetIsPressedEnabled , RobotUIButton ,

SetIsPressed

void SetIsPressed(bool pressed);
This is the method of RobotUICheckBox, RobotUISwitch and RobotUIToggleButton, that lets you set the status of the associated widget in the RobotUI app. Usually added to the RecoverStatus function, but it can also be added elsewhere if you want your arduino project to enter different states that toggle the state of buttons. Please refer to the Runtime UI update example.

bool pressed : Whether or not you want the associated widget in the RobotUI app to be pressed or not. Send True/False for pressed/not pressed.


See also, SetIsEnabled , SetIsPressedEnabled , RobotUICheckBox , RobotUISwitch , RobotUIToggleButton ,

SetIsPressedEnabled

void SetIsPressedEnabled(bool pressed, bool enabled);
This is the method of RobotUICheckBox, RobotUISwitch and RobotUIToggleButton, that lets you set the status of the associated widget in the RobotUI app AND lets you set whether it is enabled or disabled at the same time. This is like calling SetIsPressed and SetIsEnabled at the same time, which saves a little in communication speed. Usually added to the RecoverStatus function, but it can also be added elsewhere if you want your arduino project to enter different states that toggle the state of buttons. Please refer to the Runtime UI update example.

bool pressed : Whether or not you want the associated widget in the RobotUI app to be pressed or not. Send True/False for pressed/not pressed.
bool enabled : Whether or not you want the associated button in the RobotUI app to be enabled or disabled. Send True/False for enabled/disabled.


See also, SetIsEnabled , SetIsPressed , RobotUICheckBox , RobotUISwitch , RobotUIToggleButton ,

SetName

virtual void SetName(const char* newName); virtual void SetName(const __FlashStringHelper* newName);
These are the methods of RobotUIButton, RobotUICheckBox, RobotUISwitch and RobotUIToggleButton, that allow you to set up or change the names that appear on the associated widgets in the RobotUI app. Please refer to the Runtime UI update example.

const char* newName : A pointer to the name that you want to appear on the associated widget on the RobotUI app


See also, SetNames , RobotUIButton , RobotUICheckBox , RobotUISwitch , RobotUIToggleButton ,

SetNames

virtual void SetNames(const char* newOnName, const char* newOffName); virtual void SetNames(const __FlashStringHelper* newOnName, const __FlashStringHelper* newOffName);
These is the method of RobotUIToggleButton that allows you to set up or change the names that appear on the associated Toggle Button in the RobotUI app. Please refer to the Runtime UI update example.

const char* newOnName : The name that you want to appear on the associated toggle button in the RobotUI app while it is on.
const char* newOffName : The name that you want to appear on the associated toggle button in the RobotUI app while it is off.


See also, SetName , RobotUIToggleButton ,

SetOption

void RobotUISpinner::SetOption(char optionIndex)
This is the method of RobotUISpinner that allows you to set up or change the current selected option that appears on the associated Spinner widget in the RobotUI app. Please refer to the Runtime UI update example.

char optionIndex : The index of the option that you want to appear selected on the associated spinner in the RobotUI app.


See also, SetOptionEnabled , RobotUISpinner ,

SetOptionEnabled

void RobotUISpinner::SetOptionEnabled(char optionIndex, bool enabled)
This is the method of RobotUISpinner that allows you to set up or change the current selected option that appears on the associated Spinner widget in the RobotUI app. It also allows you to set whether it is enabled or disabled at the same time. Please refer to the Runtime UI update example.

char optionIndex : The index of the option that you want to appear on the associated spinner in the RobotUI app.
bool enabled : Whether or not you want the associated spinner in the RobotUI app to be enabled or disabled. Send True/False for enabled/disabled.


See also, SetOption , RobotUISpinner ,

SetOptions

void RobotUISpinner::SetOptions(char const * const * const options, char numOptions, char selectedOption)
This is the method of RobotUISpinner that allows you to set up what options that appear on the associated Spinner widget in the RobotUI app. Please refer to the Runtime UI update example.

char const * const * const options : A pointer to an array of pointers to names of the options that you want to appear on the associated spinner in the RobotUI app.
char numOptions : The number of options in the "options" array specified by the previous parameter
char selectedOption : The index of the option that you want to appear selected on the associated spinner in the RobotUI app.


See also, SetOptionsF , RobotUISpinner ,

SetOptionsF

void RobotUISpinner::SetOptionsF(char const * const * const options PROGMEM, char numOptions, char selectedOption)
This is the PROGMEM version of the method of RobotUISpinner that allows you to set up what options that appear on the associated Spinner widget in the RobotUI app. Please refer to the Runtime UI update example.

char const * const * const options PROGMEM : A pointer to an array of pointers to names stored in program memory of the options that you want to appear on the associated spinner in the RobotUI app.
char numOptions : The number of options in the "options" array specified by the previous parameter
char selectedOption : The index of the option that you want to appear selected on the associated spinner in the RobotUI app.


See also, SetOptions , RobotUISpinner ,

SetProgress

void RobotUISeekBar::SetProgress(char progress)
This is the method of RobotUISeekBar that allows you to set the current progress of the associated SeekBar widget in the RobotUI app. Please refer to the Runtime UI update example.

char progress : The amount of progress you want to appear on the associated progress bar widget in the RobotUI app.


See also, SetProgressEnabled , RobotUISeekBar ,

SetProgressEnabled

void RobotUISeekBar::SetProgressEnabled(char progress, bool enabled)
This is the method of RobotUISeekBar that allows you to set the current progress of the associated SeekBar widget in the RobotUI app. It also allows you to set whether it is enabled or disabled at the same time. Please refer to the Runtime UI update example.

char progress : The amount of progress you want to appear on the associated progress bar widget in the RobotUI app.
bool enabled : Whether or not you want the associated seek bar in the RobotUI app to be enabled or disabled. Send True/False for enabled/disabled.


See also, SetProgress , RobotUISeekBar ,

SetText

void RobotUIText::SetText(const char* newText)
This is the method of RobotUIText that allows you to set the text contents of the associated text widget in the RobotUI app. Please refer to the Runtime UI update example.

const char* newText : The new text that replaces the current contents of the associated text widget in the RobotUI app


See also, AppendText , RobotUIText ,

StartHorizontal

void RobotUI::StartHorizontal(int weight)
This is a method of RobotUI used in the LayoutDef function. It starts a section of widgets that are to be displayed in a horizontal pattern. Please refer to the LayoutDef example.

int weight : The size weight of this widget compared to the other widgets in this group


See also, EndHorizontal , EndHorizontalScroll , EndLayout , EndVertical , EndVerticalScroll , StartHorizontalScroll, StartLayout , StartVertical , StartVerticalScroll , RobotUI ,

StartHorizontalScroll

void RobotUI::StartHorizontalScroll(int weight)
This is a method of RobotUI used in the LayoutDef function. It starts a section of widgets that are to be horizontally scrollable. Please refer to the LayoutDef example.

int weight : The size weight of this widget compared to the other widgets in this group


See also, EndHorizontal , EndHorizontalScroll , EndLayout , EndVertical , EndVerticalScroll , StartHorizontal , StartLayout , StartVertical , StartVerticalScroll , RobotUI ,

StartLayout

void RobotUI::StartLayout()
This is a method of RobotUI used in the LayoutDef function. It is the first call to signify the start of the layout definition. Please refer to the LayoutDef example.

See also, EndHorizontal , EndHorizontalScroll , EndLayout , EndVertical , EndVerticalScroll , StartHorizontal , StartHorizontalScroll, StartVertical , StartVerticalScroll , RobotUI ,

StartVertical

void RobotUI::StartVertical(int weight)
This is a method of RobotUI used in the LayoutDef function. It starts a section of widgets that are to be displayed in a vertical pattern. Please refer to the LayoutDef example.

int weight : The size weight of this widget compared to the other widgets in this group


See also, EndHorizontal , EndHorizontalScroll , EndLayout , EndVertical , EndVerticalScroll , StartHorizontal , StartHorizontalScroll, StartLayout , StartVerticalScroll , RobotUI ,

StartVerticalScroll

void RobotUI::StartVerticalScroll(int weight)
This is a method of RobotUI used in the LayoutDef function. It starts a section of widgets that are to be vertically scrollable. Please refer to the LayoutDef example.

int weight : The size weight of this widget compared to the other widgets in this group


See also, EndHorizontal , EndHorizontalScroll , EndLayout , EndVertical , EndVerticalScroll , StartHorizontal , StartHorizontalScroll, StartLayout , StartVertical , RobotUI ,

Update

unsigned long RobotUI::Update()
This is the method of RobotUI that needs to be called regularly in order for the RobotUI library to operate. Adding it to the Arduino loop function works the best. An example can be found in the development guide

See also, RobotUI ,