UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

NUNCHUCK Class

Module: nunchuck

UPM module for the Wii Nunchuk controller. This module was tested with Wii Nunchuck connected to I2C via a Grove Wii Nunchuck 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 'groove' should be on the same side as the Grove interface socket on the adapter.
nunchuck.jpg

Item Index

Methods

Methods

NUNCHUCK

(
  • bus
)
Number

NUNCHUCK constructor

Parameters:

  • bus Number

    I2C bus to use

Returns:

Number:

update

()

Reads and updates the current state of the controller.

Properties

stickX

Number

Current analog stick X position

stickY

Number

Current analog stick Y position

accelX

Number

Current accelerometer X value

accelY

Number

Current accelerometer Y value

accelZ

Number

Current accelerometer Z value

buttonC

Boolean

Button C pressed?

buttonZ

Boolean

Button Z pressed?