The Adafruit MacroPad has a number of great features, all of which work great with CircuitPython. The Adafruit CircuitPython MacroPad library wraps all of those features into one place to make it super simple to get started using CircuitPython with your Adafruit MacroPad.

This section provides a few examples of using the MacroPad CircuitPython library to read key presses, the rotary encoder values and rotary encoder switch state, and to send HID and MIDI commands.

The MacroPad library is easy to use. Simply import it, and then create an instance of it in your code. To do this, you include the following two lines at the beginning of your program.

from adafruit_macropad import MacroPad

macropad = MacroPad()

Then, you're ready to access all the features of the library using macropad. Each of the examples will show you how to access different features of the library.

First, you'll want to install the MacroPad library and its dependencies.

MacroPad Library Installation

To use the MacroPad library, you'll need to install it and a few other CircuitPython libraries on your CIRCUITPY drive.

There are two ways to get the necessary libraries onto your CIRCUITPY drive. You can click the Download Project Bundle button at the top of each example, open the 7.x folder within, and copy the code.py file and the lib folder to your CIRCUITPY drive.

Alternatively, you can follow the instructions below.

Download the latest Adafruit CircuitPython Bundle that matches the version of CircuitPython you're using.

Extract the zip and navigate to the lib folder found within. Drag the necessary libraries from the zip lib folder to the lib folder on your CIRCUITPY drive.

At a minimum, the following libraries are required to use the MacroPad CircuitPython library. Drag the following files and folders to the lib folder on your CIRCUITPY drive:

  • adafruit_macropad.mpy - A helper library for using the features of the Adafruit MacroPad.
  • adafruit_debouncer.mpy - A helper library for debouncing pins. Used to provide a debounced instance of the rotary encoder switch.
  • adafruit_simple_text_display.mpy - A helper library for easily displaying lines of text on a display.
  • neopixel.mpy - A CircuitPython driver for NeoPixel LEDs.
  • adafruit_display_text/ - A library to display text using displayio. Used for the text display functionality of the MacroPad library that allows you easily display lines of text on the built-in display.
  • adafruit_hid/ - CircuitPython USB HID drivers.
  • adafruit_midi/ - A CircuitPython helper for encoding/decoding MIDI packets over a MIDI or UART connection

There is an example included that uses a library that is not required for the MacroPad library to work, but provides a convenient way to layout text in grid. The following library is recommended as well:

  • adafruit_displayio_layout - A library that includes a grid layout helper.

This guide was first published on Jun 30, 2021. It was last updated on 2021-07-29 15:09:16 -0400.

This page (MacroPad CircuitPython Library) was last updated on Sep 16, 2021.

Text editor powered by tinymce.