{
  "id": "mattytrentini/micropython-step16",
  "name": "micropython-step16",
  "prettyName": "micropython-step16",
  "description": "MicroPython I2C driver for the M5Stack Unit Step16 rotary encoder",
  "version": "",
  "author": "mattytrentini",
  "license": "MIT",
  "tags": [],
  "status": "VALID",
  "official": false,
  "source": "https://github.com/mattytrentini/micropython-step16",
  "updatedAt": "2026-11-23T00:48:34.662Z",
  "page": "https://checkmim.com/packages/mattytrentini+micropython-step16",
  "createdAt": "2026-11-23T00:48:32.354Z",
  "submittedBy": "Matt",
  "install": {
    "mpremote": "mpremote mip install github:mattytrentini/micropython-step16",
    "mip": "import mip; mip.install(\"github:mattytrentini/micropython-step16\")"
  },
  "readme": "# Step16 for MicroPython\n\nMIT-licensed I²C driver for the [M5Stack Unit Step16](https://docs.m5stack.com/en/unit/Unit_Step16).\nRead the encoder's absolute detent (0–15) and firmware version, and control\nits RGB LED.\n\n## Install\n\n```sh\nmpremote mip install github:mattytrentini/micropython-step16\n```\n\nOn a network-connected MicroPython board:\n\n```python\nimport mip\nmip.install(\"github:mattytrentini/micropython-step16\")\n```\n\n## Read the encoder\n\nPass an initialized `machine.I2C` or `machine.SoftI2C` bus and power the unit\nbefore reading. Use the pins and bus number for your board. The default\n7-bit I²C address is `0x48`.\n\n```python\nfrom step16 import Step16\n\nencoder = Step16(i2c)\nprint(\"Firmware:\", encoder.firmware_version())\nprint(\"Detent: {:X}\".format(encoder.position()))\n```\n\nThe firmware refreshes the detent about every 100 ms. The\n[CoreMatrix application](https://github.com/mattytrentini/m5stack-core-matrix-app)\ninstalls this driver as a dependency and provides a demo that powers Grove\nPort A and displays the detent on its matrix.\n\n## Control the RGB LED\n\n```python\nencoder.led.on = True\nencoder.led.brightness = 100\nencoder.led.rgb = (255, 0, 255)  # Magenta\n```\n\nAll three properties can also be read. `on` controls RGB power independently\nof brightness (an integer percentage from 0 to 100) and `rgb` (three unscaled\nintegers from 0 to 255, in red, green, blue order). The firmware may take\nabout 50 ms to display the color after enabling RGB power.\n\nThese settings are not saved to flash and do not affect the detent indicator.\n\nProtocol: [M5Stack Unit Step16 I²C register map](https://m5stack-doc.oss-cn-shenzhen.aliyuncs.com/1160/Unit-Step16_Protocol.pdf).\n"
}