Interrupt on teensy 4.0 + Adafruits Neotrellis

I installed Adafruits seesaw library in Arduino IDE.

There are noetrellis and multitrellis examples

I have new data.

Now sometimes does print Hello just once and sometimes keeps printing. When it keeps printing, sometimes, when I press again stops again.

Tha would mean its not a code problem and more of a hardware thing?

It means do what I suggested way back in Post #13. Do it repeatedly and look for differences.

I dont have the voltmeter yet, until it arrives Im trying different things. I have an idea.

My proyect consists of 32 Neotrellis boards tiled together
When I was trying with an Arduino due (that didnt work because of processing speed) Some people suggested that the Neotrellis boards when tiled together had too many pullup resistors and that I should remove half of those. I did.
Now I realize that if I load only 16 boards it works fine but with more than that the endless printing appears.

Could it be that I shoud remove more pullups? Some suggested I should remove 3/4 of them. I think I did less than half.

What is the value of the pullup resistors on those boards? 10k? That is a pretty common value for i2c devices. The entire bus only needs pull-up resistance of about 2k.

How much wire do you have between all these boards? That can also lead to higher capacitance and issues.

Yes 10k pull ups
This is the schematic of the boards

They are 5cmx5cm and placed side by side

So all these boards are soldered together like adafruit describes with just 1 connector? And you have changed all the i2c address jumpers so they are are unique?

FYI... Can you compile the Neotrellis interrupt example? You had errors in reply #16, but the example should compile just fine.

You can also run the i2c scanner sketch to see what is on the bus.

Yes. All soldered together in a 4x8 boards grid with Sda, Scl, interrupt and ground to the teensy 4.0.

All the addresses are unique.

I can complie and make it work just fine loading only 16 boards on the sketch

All devices are scanned

/* This example shows basic usage of the
MultiTrellis object controlling an array of
NeoTrellis boards

As is this example shows use of two NeoTrellis boards
connected together with the leftmost board having the
default I2C address of 0x2E, and the rightmost board
having the address of 0x2F (the A0 jumper is soldered)

#include "Adafruit_NeoTrellis.h"

#define Y_DIM 16 //number of rows of key
#define X_DIM 32 //number of columns of keys
#define INT_PIN 8
//create a matrix of trellis panels
Adafruit_NeoTrellis t_array[Y_DIM/4][X_DIM/4] = {
 { Adafruit_NeoTrellis(0x35), Adafruit_NeoTrellis(0x3A), Adafruit_NeoTrellis(0x4A), Adafruit_NeoTrellis(0x33),Adafruit_NeoTrellis(0x4B), Adafruit_NeoTrellis(0x45), Adafruit_NeoTrellis(0x4C), Adafruit_NeoTrellis(0x42) },
{ Adafruit_NeoTrellis(0x4D), Adafruit_NeoTrellis(0x3E) , Adafruit_NeoTrellis(0x40), Adafruit_NeoTrellis(0x38),Adafruit_NeoTrellis(0x31), Adafruit_NeoTrellis(0x3D), Adafruit_NeoTrellis(0x3B), Adafruit_NeoTrellis(0x49) },

{ Adafruit_NeoTrellis(0x2F), Adafruit_NeoTrellis(0x2E), Adafruit_NeoTrellis(0x3C), Adafruit_NeoTrellis(0x47),Adafruit_NeoTrellis(0x32), Adafruit_NeoTrellis(0x36), Adafruit_NeoTrellis(0x48), Adafruit_NeoTrellis(0x3F)  },

  { Adafruit_NeoTrellis(0x34), Adafruit_NeoTrellis(0x44), Adafruit_NeoTrellis(0x39), Adafruit_NeoTrellis(0x41), Adafruit_NeoTrellis(0x30), Adafruit_NeoTrellis(0x37), Adafruit_NeoTrellis(0x43), Adafruit_NeoTrellis(0x46) }

If you were using a 2x2 array of NeoTrellis boards, the above lines would be:

#define Y_DIM 8 //number of rows of key
#define X_DIM 8 //number of columns of keys

//create a matrix of trellis panels
Adafruit_NeoTrellis t_array[Y_DIM/4][X_DIM/4] = {
  { Adafruit_NeoTrellis(0x2E), Adafruit_NeoTrellis(0x2F) },

  { Adafruit_NeoTrellis(LOWER_LEFT_I2C_ADDR), Adafruit_NeoTrellis(LOWER_RIGHT_I2C_ADDR) }

//pass this matrix to the multitrellis object
Adafruit_MultiTrellis trellis((Adafruit_NeoTrellis *)t_array, Y_DIM/4, X_DIM/4);

// Input a value 0 to 255 to get a color value.
// The colors are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return seesaw_NeoPixel::Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return seesaw_NeoPixel::Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return seesaw_NeoPixel::Color(0, WheelPos * 3, 255 - WheelPos * 3);
  return 0;

//define a callback for key presses
TrellisCallback blink(keyEvent evt){
    trellis.setPixelColor(evt.bit.NUM, Wheel(map(evt.bit.NUM, 0, X_DIM*Y_DIM, 0, 255))); //on rising
    trellis.setPixelColor(evt.bit.NUM, 0); //off falling;
  return 0;

void setup() {
  pinMode(INT_PIN, INPUT);
    Serial.println("failed to begin trellis");

  /* the array can be addressed as x,y or with the key number */
  for(int i=0; i<Y_DIM*X_DIM; i++){
      trellis.setPixelColor(i, Wheel(map(i, 0, X_DIM*Y_DIM, 0, 255))); //addressed with keynum;
  for(int y=0; y<Y_DIM; y++){
    for(int x=0; x<X_DIM; x++){
      //activate rising and falling edges on all keys
      trellis.activateKey(x, y, SEESAW_KEYPAD_EDGE_RISING, true);
      trellis.activateKey(x, y, SEESAW_KEYPAD_EDGE_FALLING, true);
      trellis.registerCallback(x, y, blink);
      trellis.setPixelColor(x, y, 0x000000); //addressed with x,y; //show all LEDs


void loop() {

So, with all 32 boards installed, the i2c scanner sketch reports all 32 boards at unique addresses, but your code doesn't work? But if you only install 16 then your code works?

I did notice this difference between your code and the interrupt example code

void loop() {
  if (!digitalRead(INT_PIN)) {;
void loop() {
  if (!digitalRead(INT_PIN)) {;

You are not doing polling since you are using the interrupt pin.

Yes to all.

If I load the neotrellis sketch for only one board with;

it complies but if I load more than one board with False I get an error.

Anyway. I just loaded only one board and got the error. It is very erratic.

I will wait to get the voltmeter to see what the interrupt wire reads

I dug into the libraries a bit and it turns out that you have the option of polling or not for a single trellis board, but once you switch over to the multitrellis class, it is simply .read()


Thanks for that.

Could this be the problem?

I also noticed that if I do this

void loop() {
  if (!digitalRead(INT_PIN)) {

When I press a button it keeps printing. In both Neotrellis and Multitrellis

That loop() is going to execute thousands of times per second which is way faster than the pulse on the INT_PIN so that condition will be true many, many times.

Yes. But when I let go it keeps going...

Could the (false) vs be the issue?

Tomorrow I get the voltmeter to read the pin