LRemote Control Classes
These control classes are provided to create UI controls to the canvas created by LRemote:
LRemoteLabel: a static text label
LRemoteButton: a rectangular button with a text label
LRemoteCircleButton: a round, circular button with a text label
LRemoteSlider: a slider with adjustable range and initial value
LRemoteSwitch: a on/off switch
LRemoteJoystick: an analog joystick control
To use these classes, declare them in the global context:
#include <LRemote.h>
LRemoteLabel label;
LRemoteButton button;
LRemoteSlider slider;
LRemoteSwitch switchButton;
LRemoteCircleButton bigButton;
void setup() {
}And adjust the text label, position and size in setup() function, and then call LRemote.addControl() to add the control to the remote UI canvas.
void setup() {
LRemote.setGrid(3, 5);
// Add a push button
button.setText("Press Me");
button.setPos(1, 1);
button.setSize(2, 1);
button.setColor(RC_PINK);
LRemote.addControl(button);
LRemote.begin();
}Methods for All Controls
setText()
setColor()
setPos()
setSize()
Set the text label of the control
Syntax
text: a String representing the text label of the control
Returns
none
Set the color of the control
Syntax
color: The color of the control, must be one of the following enumerations:
RC_ORANGERC_BLUERC_GREENRC_PINKRC_GREYRC_YELLOW
Returns
none
Position of the control. The coordinate is the canvas grid determined by LRemote.setGrid() API.
Syntax
Parameters
x: position on the x-axis, ranging from 0 to (canvas grid column - 1)
y: position on the y-axis, ranging from 0 to (canvas grid row - 1)
Returns
none
Size of the control. The unit is a single row/column in the canvas grid determined by LRemote.setGrid() API.
Syntax
Parameters
w: width of the control. The unit is canvas grid cell
h: height of the control. The unit is canvas grid cell
Returns
none
Methods for All Controls except LRemoteLabel
isValueChanged()
getValue()
Check if the LinkIt Remote app has made a change to the UI control
Syntax
none
Returns
true if the LinkIt Remote has made changes to this control.
false if the LinkIt Remote hasn't made any changes to this control since last call to LRemote.process().
The the current value of the control
Syntax
none
Returns
LRemoteSlider
Current slider value
LRemoteButton
LRemoteCircleButton
1: Pressed
0: Not pressed
LRemoteSwitch
1: Switch on
0: Switch off
LRemoteJoystick
LRemoteDirection
You can use .x and .y to access the value in X-axis and Y-axis.
The value ranges from -100 (leftmost/bottommost) to 100(topmost/rightmost).
Methods for LRemoteSlider Only
setValueRange()
Set the range of values for the slider control
Syntax
min_value: The minimum allowed value for the slider. The limit is -32767.
max_value: The maximum value allowed for the slider. The limit is 32767.
init_value: The inital value of the slider.
Returns
none
Methods for LRemoteLabel Only
updateText()
Change the label text. You can change the text after the user has connected.
Syntax
new_text: The new text to be update to the label. The limitation is 15 bytes.
Returns
none
Last updated