BindJoystick Class. More...
#include <BindJoystick.hpp>
Public Member Functions | |
void | setCallback (void(*callback)(int16_t, int16_t)) |
Set the Callback function for the joystick. | |
void | invokeCallback (int16_t xIn, int16_t yIn) |
uint16_t | getBytes (uint8_t *out) override |
Serialize the joystick object into bytes. | |
Public Attributes | |
int16_t | x = 0 |
The x-coordinate position of the joystick on the screen. | |
int16_t | y = 0 |
The y-coordinate position of the joystick on the screen. | |
uint8_t | cmdId = 0 |
Command identifier to add or refresh the joystick. See the notes for possible cmdId values. | |
int16_t | dimSize = 200 |
The dimensions (size) of the joystick. | |
int16_t | sX = 0 |
The joystick's current X-axis position (internal). | |
int16_t | sY = 0 |
The joystick's current Y-axis position (internal). | |
bool | springed = true |
Indicates whether the joystick returns to the center automatically when released. | |
![]() | |
int16_t | tag |
BindJoystick Class.
The BindJoystick
class is a part of the Bind framework for Arduino, designed to creat a joystick element that can be displayed and controlled on the BindCanvas Android app interface.
This class allows you to define the properties of a joystick, including its position, size, spring behavior, and more. You can synchronize these properties with BindCanvas to provide joystick controls in your Arduino projects.
bind.sync()
in your main loop.To use the BindJoystick
class effectively, you can create an instance, set the callback function, set its attributes, and call bind.sync(your_joystick)
to synchronize it with BindCanvas.
Example usage:
|
inlineoverridevirtual |
Serialize the joystick object into bytes.
This function serializes the joystick object into a byte array, allowing it to be sent and displayed on BindCanvas.
out | A pointer to the byte array where the serialized data will be stored. |
Reimplemented from BindView.
|
inline |