Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 920 Bytes

README.md

File metadata and controls

43 lines (32 loc) · 920 Bytes

TinyNunchuk

This is a library for an ATTiny85 to use a Wii Nunchuk, over I2C.

The Wii Nunchuk is a controller with a joystick, accelerometer, and two buttons. It communicates over I2C at 3.3V.

Example Usage

// Choose your I2C implementation before including TinyNunchuk.h
// The default if none is selected is Wire.h

// To use the Wire library:
//#include <Wire.h>

// To use the Adafruit's TinyWireM library:
//#include <TinyWireM.h>

// To use the TinyI2C library from https://github.com/technoblogy/tiny-i2c
//#include <TinyI2CMaster.h>

#include <TinyNunchuk.h>

void setup() {
  // Send the initialization sequence to the nunchuk.
  nunchuk.begin();
}

void loop() {
  nunchuk.update();

  // Nunchuk Joystick position:
  // nunchuk.x
  // nunchuk.y
  // Nunchuk Acceleration:
  // nunchuk.ax
  // nunchuk.ay
  // nunchuk.az
  // Nunchuk Button states:
  // nunchuk.c
  // nunchuk.z
}