Makeblock-library-for-Arduino  V3.2.4
It's a library for arduino application developers
Public Member Functions | List of all members
MeJoystick Class Reference

Driver for Me Joystick module. More...

#include <MeJoystick.h>

Inheritance diagram for MeJoystick:
MePort

Public Member Functions

 MeJoystick (void)
 
 MeJoystick (uint8_t port)
 
void setpin (uint8_t x_port, uint8_t y_port)
 
int16_t readX (void)
 
int16_t readY (void)
 
int16_t read (uint8_t index)
 
void CalCenterValue (int16_t=0, int16_t=0)
 
float angle (void)
 
float OffCenter (void)
 
- Public Member Functions inherited from MePort
 MePort (void)
 
 MePort (uint8_t port)
 
 MePort (uint8_t port, uint8_t slot)
 
uint8_t getPort (void)
 
uint8_t getSlot (void)
 
bool dRead1 (uint8_t mode=INPUT)
 
bool dRead2 (uint8_t mode=INPUT)
 
bool dpRead1 (void)
 
bool dpRead2 (void)
 
void dWrite1 (bool value)
 
void dWrite2 (bool value)
 
int16_t aRead1 (void)
 
int16_t aRead2 (void)
 
void aWrite1 (int16_t value)
 
void aWrite2 (int16_t value)
 
void reset (uint8_t port)
 
void reset (uint8_t port, uint8_t slot)
 
uint8_t pin1 (void)
 
uint8_t pin2 (void)
 
uint8_t pin (void)
 
uint8_t pin (uint8_t port, uint8_t slot)
 

Additional Inherited Members

- Protected Attributes inherited from MePort
uint8_t s1
 
uint8_t s2
 
uint8_t _port
 
uint8_t _slot
 

Detailed Description

Driver for Me Joystick module.

Class: MeJoystick

Description
Declaration of Class MeJoystick.
Copyright (C), 2012-2016, MakeBlock

Constructor & Destructor Documentation

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
[in]None
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

Member Function Documentation

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