Driver for Me Joystick module.
More...
#include <src/MeJoystick.h>
Driver for Me Joystick module.
Class: MeJoystick
- Description
- Declaration of Class MeJoystick.
- Copyright (C), 2012-2016, MakeBlock
◆ MeJoystick() [1/2]
| MeJoystick::MeJoystick |
( |
void |
| ) |
|
Alternate Constructor which can call your own function to map the MeJoystick to arduino port, no pins are used or initialized here.
- Parameters
-
◆ MeJoystick() [2/2]
| MeJoystick::MeJoystick |
( |
uint8_t |
port | ) |
|
Alternate Constructor which can call your own function to map the MeJoystick to arduino port.
- Parameters
-
| [in] | port | - RJ25 port from PORT_1 to M2 |
◆ angle()
| float MeJoystick::angle |
( |
void |
| ) |
|
- Function
- angle
- Description
- We can use function to get the angle of the joystick
- Output
- None
- Returns
- The angle of the joystick(-180 - 180)
- Others
- None
◆ CalCenterValue()
| void MeJoystick::CalCenterValue |
( |
int16_t |
x_offset = 0, |
|
|
int16_t |
y_offset = 0 |
|
) |
| |
- Function
- CalCenterValue
- Description
- If joystick not been triggered(The default middle position), But the X-axis and Y-axis is not 0, we can use this function to calibration its 0 value.
- Parameters
-
| [in] | x_offset | - The offset vlaue we needed to calibrate the X-axis |
| [in] | y_offset | - The offset vlaue we needed to calibrate the Y-axis |
- Output
- None
- Returns
- None
- Others
- None
◆ OffCenter()
| float MeJoystick::OffCenter |
( |
void |
| ) |
|
- Function
- OffCenter
- Description
- We can use function to get the off-center distance of the joystick
- Output
- None
- Returns
- The off-center distance of the joystick(0 - 700)
- Others
- None
◆ read()
| int16_t MeJoystick::read |
( |
uint8_t |
index | ) |
|
- Function
- read
- Description
- Get the value of setting axis
- Parameters
-
| [in] | index | - '1' for X-axis and '2' for Y-axis |
- Output
- None
- Returns
- The setting axis value from(-500 - 500)
- Others
- None
◆ readX()
| int16_t MeJoystick::readX |
( |
void |
| ) |
|
- Function
- readX
- Description
- Get the value of X-axis
- Output
- None
- Returns
- The X-axis value from(-500 - 500)
- Others
- None
◆ readY()
| int16_t MeJoystick::readY |
( |
void |
| ) |
|
- Function
- readY
- Description
- Get the value of Y-axis
- Output
- None
- Returns
- The Y-axis value from(-500 - 500)
- Others
- None
◆ setpin()
| void MeJoystick::setpin |
( |
uint8_t |
x_port, |
|
|
uint8_t |
y_port |
|
) |
| |
- Function
- setpin
- Description
- Reset the MeJoystick available PIN by its arduino port.
- Parameters
-
| [in] | x_port | - arduino port for X value PIN(should analog pin) |
| [in] | y_port | - arduino port for Y value PIN(should analog pin) |
- Output
- None
- Returns
- None
- Others
- None
The documentation for this class was generated from the following files: