PHPackages                             dept-of-scrapyard-robotics/wii-connector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. dept-of-scrapyard-robotics/wii-connector

ActiveLibrary[Framework](/categories/framework)

dept-of-scrapyard-robotics/wii-connector
========================================

Drive Wii/NES/SNES Classic controllers and nunchucks over I2C with PHP

0.6.0(1mo ago)00MITPHPPHP ^8.4|^8.5|^8.6

Since Jul 12Pushed 1mo agoCompare

[ Source](https://github.com/DeptOfScrapyardRobotics/wii-connector)[ Packagist](https://packagist.org/packages/dept-of-scrapyard-robotics/wii-connector)[ Docs](https://dosr.projectsaturnstudios.com)[ RSS](/packages/dept-of-scrapyard-robotics-wii-connector/feed)WikiDiscussions 0.6.x Synced 1w ago

READMEChangelogDependencies (15)Versions (4)Used By (0)

Wii Connector
=============

[](#wii-connector)

### Drive Wii / NES / SNES Classic controllers and Nunchucks over I²C with PHP

[](#drive-wii--nes--snes-classic-controllers-and-nunchucks-over-ic-with-php)

PHP package for Nintendo Wii extension controllers that speak the classic I²C protocol (default slave **0x52**). It sits on the ScrapyardIO GPIO I²C stack, boots with the plaintext handshake used by CircuitPython / Adafruit drivers, and plugs digital buttons into BareMetal HumanInput (`BasicButton`, `DigitalButtonPad`). The Nunchuck also implements `AccelerationMeasurable` so it can wrap in BareMetal `Accelerometer`.

**Which device do I need?**

- **Wii Classic** (`WiiClassicController`) — dual sticks, analog shoulders, full face / Z / HOME set
- **SNES Classic** (`SNESClassicController`) — no sticks; digital pad is A/B/X/Y, L/R, START/SELECT, d-pad (no HOME / ZL / ZR)
- **NES Classic** (`NESClassicController`) — thin subclass of Classic (same I²C report; use Classic/SNES APIs as appropriate for your pad)
- **Nunchuck** (`WiiNunchuck`) — stick, C/Z buttons, 3-axis accel

Compatible I²C Interfaces
=========================

[](#compatible-ic-interfaces)

These peripherals are 3.3 V I²C devices (often on a Wiimote-style breakout or adapter).

You can interface with them the following ways:

- A Linux single-board computer's I²C bus using the POSIX carrier (`posix`) — e.g. `/dev/i2c-1` on Raspberry Pi
- An MPSSE-enabled USB-to-serial device such as an FT232H using the USB carrier (`usb`)

Default address is `WiiConnectorI2CAddress::DEFAULT` (**0x52**).

Dependencies
============

[](#dependencies)

This package makes use of modules within:

- [The ScrapyardIO Framework](https://github.com/ScrapyardIO/framework)

For I²C you also need a carrier, for example:

- [POSI Extension](https://github.com/php-io-extensions/posi) + [Microscrap POSIX](https://github.com/microscrap/posix) / POSIX drivers, **or**
- [FTDI / MPSSE](https://github.com/microscrap/mpsse) path for USB

Confirm the bus sees the device (Pi example):

```
i2cdetect -y 1
# expect 0x52 when the controller is connected and powered
```

Installing from Composer
========================

[](#installing-from-composer)

```
composer require dept-of-scrapyard-robotics/wii-connector
```

Basic Usage
===========

[](#basic-usage)

Build an `I2CAPI` with the GPIO facade, pass it into the controller, and call `boot()` (or `boot_now: true`) so the driver runs the init handshake.

### Wii Classic Controller

[](#wii-classic-controller)

```
