Best way to iterate through single character buffer to chained displays?

This is basic likely, however it's early and my coffee hasn't absorbed yet (not to mention C++ skill still in the works).

I have three alphanumeric displays that display a total of 12 characters.

I can quickly show "AAAAAAAAAAAA" like this:

#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"

Adafruit_AlphaNum4 alpha4[3];

void setup() {

  for (uint8_t i=0; i<3; i++) {
    alpha4[i] = Adafruit_AlphaNum4();
    alpha4[i].begin(0x70 + i);

  // Show "AAAA AAAA AAAA"
  char a = 'A';
  for (uint8_t i=0; i<3; i++) {
    for (uint8_t n=0; n<4; n++) {
      alpha4[i].writeDigitAscii(n, a);

  // I really want to show this:
  char charBuffer[12] = {'L', 'O', 'V', 'E', 'T', 'H', 'A', 'T', 'C', 'O', 'D', 'E'};

  for (uint8_t i=0; i<12; i++) {
    uint8_t displayInt = 0; // ??? Which 0-2 display to show on?
    uint8_t posInt = 0; // ??? Which 0-3 character to update?
    alpha4[displayInt].writeDigitAscii(posInt, charBuffer[i]);

What's the best way to iterate through charBuffer with 12 characters (which will change often) to show on the three displays in sequential order?

Thanks for taking a look. :slight_smile:

presumably you need an index to one of 3 displays and an index for each character on like you did in the one loop

int dispIdx = i / 4;
int charIdx = i % 4;


Thank you.