Library Reference

Now that you have the demo working, you can control the matrix directly.

Initialize

Start by creating a new matrix object with something like:

Adafruit_IS31FL3731 ledmatrix = Adafruit_IS31FL3731();

There's no arguments to the constructor

Then in your setup, call begin(address) to initialize the driver. Begin() will return false if the matrix was not found, and true if initialization worked out

  if (! ledmatrix.begin()) {
    Serial.println("IS31 not found");
    while (1);
  }
  Serial.println("IS31 found!");

Drawing

You can then draw to the display. Note that since we write directly to the driver RAM, any pixels 'drawn' will appear immediately.

You can start with drawPixel(x, y, brightness) where x ranges between 0 and 15 inclusive, and y ranges between 0 and 8 inclusive. Brightness is the PWM of the LED, 0 is off, and 255 is all the way on.

This loop will light up every LED in increasing brightness:

int i = 0;
for (uint8_t x=0; x<16; x++) {
  for (uint8_t y=0; y<9; y++) {
    ledmatrix.drawPixel(x, y, i++]);
  }
}

Adafruit GFX

Once you get pixels drawing, you can use Adafruit GFX to draw lines, rectangles, circles, text, etc.

The Adafruit_GFX library for Arduino provides a common syntax and set of graphics functions for all of our LED, TFT, LCD and OLED displays. This allows Arduino sketches to easily be adapted between display types with minimal fuss…and any new features, performance improvements and bug fixes will immediately apply across our complete offering of color displays.

Check out our detailed tutorial here http://learn.adafruit.com/adafruit-gfx-graphics-library It covers the latest and greatest of the GFX library!

Multiple Buffers

The IS31 has 8 full display frame buffers available. By default you draw and display to frame buffer #0

But! If you want to flip thru different images quickly, you can double buffer by writing to one buffer and then telling the IS31 to switch which one is visible.

To set which frame we are drawing to, use setFrame(n)
where n ranges from 0 to 7 inclusive

ledmatrix.setFrame(frame);

Then when you are ready to display it, to set which frame we are displaying to, use displayFrame(n)
where n ranges from 0 to 7 inclusive

ledmatrix.displayFrame(frame);
Last updated on Nov 26, 2017 Published on Mar 09, 2016