upm
0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for the Wii* Nunchuk controller. More...
UPM module for the Wii Nunchuk controller. This module was tested with Wii Nunchuk connected to I2C via a Grove Wii Nunchuk adapter.
See http://wiibrew.org/wiki/Wiimote/Extension_Controllers and http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck for more details on the controller and its protocol.
A warning for the Grove Wii Nunchuk adapter: it has 2 traces on one side, and 3 traces on the other. Do not match these up with the Nunchuk connector's traces. The connector's 'Grove' should be on the same side as the Grove interface socket on the adapter.
Public Member Functions | |
synchronized void | delete () |
NUNCHUCK (int bus, short addr) | |
NUNCHUCK (int bus) | |
boolean | writeByte (short reg, short arg1) |
int | readBytes (short reg, byte[] buffer) |
boolean | init () |
void | update () |
void | setStickX (int value) |
int | getStickX () |
void | setStickY (int value) |
int | getStickY () |
void | setAccelX (int value) |
int | getAccelX () |
void | setAccelY (int value) |
int | getAccelY () |
void | setAccelZ (int value) |
int | getAccelZ () |
void | setButtonC (boolean value) |
boolean | getButtonC () |
void | setButtonZ (boolean value) |
boolean | getButtonZ () |
NUNCHUCK | ( | int | bus, |
short | addr | ||
) |
NUNCHUCK constructor
bus | I2C bus to use |
addr | I2C address to use |
boolean init | ( | ) |
Initializes the controller. Here, we disable encryption after delaying for a time to ensure the controller is ready.
void update | ( | ) |
Reads and updates the current state of the controller.
boolean writeByte | ( | short | reg, |
short | arg1 | ||
) |
Writes value(s) into registers
reg | Register location to start writing into |
byte | Byte to write |