MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
Public Member Functions | List of all members
MePS2 Class Reference

Driver for MePS2 handle device. More...

`#include <src/MePS2.h>`

Inheritance diagram for MePS2:
[legend]
Collaboration diagram for MePS2:
[legend]

## Public Member Functions
| MePS2 ()
| MePS2 (uint8_t port)
void | readSerial (void)
uint8_t | readBuffer (int16_t index)
void | writeBuffer (int16_t index, uint8_t c)
boolean | readjoystick (void)
int16_t | MeAnalog (uint8_t button)
boolean | ButtonPressed (uint8_t button)
void | loop (void)
Public Member Functions inherited from MeSerial
| MeSerial (void)
| MeSerial (uint8_t port)
| MeSerial (uint8_t receivePin, uint8_t transmitPin, bool inverse_logic=false)
void | setHardware (bool mode)
void | begin (long baudrate)
size_t | write (uint8_t byte)
int | read ()
int | available ()
int16_t | poll (void)
void | end (void)
bool | listen (void)
bool | isListening (void)
void | sendString (char *str)
void | printf (char *fmt,...)
boolean | dataLineAvailable (void)
String | readDataLine (void)
String | concatenateWith (String s1, String s2)
char | letterOf (int i, String s)
int | stringLength (String s)
boolean | equalString (String s1, String s2)
float | getValue (String key)
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)
Public Member Functions inherited from SoftwareSerial
| SoftwareSerial (uint8_t receivePin, uint8_t transmitPin, bool inverse_logic=false)
void | begin (long speed)
bool | listen ()
void | end ()
bool | isListening ()
bool | stopListening ()
bool | overflow ()
int | peek ()
virtual void | flush ()
| operator bool ()

## Additional Inherited Members
Static Public Member Functions inherited from SoftwareSerial
static void | handle_interrupt () __attribute__((__always_inline__))
Protected Attributes inherited from MeSerial
bool | _hard
bool | _polling
bool | _scratch
int16_t | _bitPeriod
int16_t | _byte
long | _lastTime
char | buffer [64]
String | lastLine
int | bufferIndex
Protected Attributes inherited from MePort
uint8_t | s1
uint8_t | s2
uint8_t | _port
uint8_t | _slot

## Detailed Description

Driver for MePS2 handle device.

Class: MePS2

Description
  Declaration of Class MePS2.

Copyright (C), 2012-2016, MakeBlock

## Constructor & Destructor Documentation

## ◆ MePS2() [1/2]

MePS2::MePS2 | ( |  | ) |

Alternate Constructor which can call your own function to map the MePS2 to arduino port, no pins are used or initialized here.

Parameters

  [in] | None |

## ◆ MePS2() [2/2]

MePS2::MePS2 | ( | uint8_t | port | ) |

Alternate Constructor which can call your own function to map the MePS2 to arduino port, If the hardware serial was selected, we will used the hardware serial.

Parameters

  [in] | port | - RJ25 port from PORT_1 to M2

## Member Function Documentation

## ◆ ButtonPressed()

boolean MePS2::ButtonPressed | ( | uint8_t | button | ) |

Function
  ButtonPressed

Description
  This function is used to check the button whether to press.

Parameters

  [in] | Button |

Output
  None

Return
  Return button state.

Others
  None

## ◆ loop()

void MePS2::loop | ( | void |  | ) |

Function
  loop

Description
  Save the MePS2 datas to the datalist.

Parameters

  [in] | None |

Output
  None

Return
  None

Others
  None

## ◆ MeAnalog()

int16_t MePS2::MeAnalog | ( | uint8_t | button | ) |

Function
  MeAnalog

Description
  Read the handle remote sensing analog value.

Parameters

  [in] | Button |

Output
  None

Return
  Analog value(0~255). if none return 128.

Others
  None

Function
  MeAnalog

Description
  Read the handle remote sensing analog value.

Parameters

  [in] | Button |

Output

None

Return
  Analog value(-128~127). if none return 0.

Others
  None

## ◆ readBuffer()

uint8_t MePS2::readBuffer | ( | int16_t | index | ) |

Function
  readBuffer

Description
  Read the buffer data.

Parameters

  [in] | index |

Output
  None

Return
  buffer

Others
  None

## ◆ readjoystick()

boolean MePS2::readjoystick | ( | void |  | ) |

Function
  readjoystick

Description
  This function is used to read the handle datas.

Parameters

  [in] | None |

Output
  None

Return
  Returns 0 if no data ready, 1 if data ready.

Others
  None

## ◆ readSerial()

void MePS2::readSerial | ( | void |  | ) |

Function
  readSerial

Description
  Read the Serial data.

Parameters

  [in] | None |

Output
  None

Return
  None

Others
  Save the data to _serialRead.

## ◆ writeBuffer()

void MePS2::writeBuffer | ( | int16_t | index,
|  | uint8_t | c
| ) |  |

Function
  writeBuffer

Description
  Write the datas to the buffer.

Parameters

  [in] | index,c |

Output
  None

Return
  None

Others
  None

Function
  writeBuffer

Description
  Write the data to the buffer.

Parameters

  [in] | index,c |

Output
  None

Return
  None

Others
  None

The documentation for this class was generated from the following files:

- src/MePS2.h
- src/MePS2.cpp