Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Adafruit_Seesaw library support for other I2C busses.
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit_Seesaw library support for other I2C busses.

by Inspired_Chaos on Sat Jul 11, 2020 12:38 pm

I am trying to resolve the same issue as Bob in this thread: . My project is using a different wire bus than the default and the library does not allow me to specify the bus. I just wanted to find out if there was any resolution to Bob's problem or plan to update the seesaw library to address this. Thanks!

Inspired_Chaos
 
Posts: 3
Joined: Sat Jul 11, 2020 12:18 pm

Re: Adafruit_Seesaw library support for other I2C busses.

by adafruit_support_carter on Mon Jul 13, 2020 12:30 pm

The seesaw base class allows for specifying the bus in the constructor:
https://github.com/adafruit/Adafruit_Se ... saw.h#L223

What specific seesaw product are you working with?

adafruit_support_carter
 
Posts: 16820
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit_Seesaw library support for other I2C busses.

by Inspired_Chaos on Mon Jul 13, 2020 2:41 pm

I'm using Neo Trellis. I guess would have more correct to mention Adafruit_NeoTrellis that doesn't seem to allow it. Thanks!

Inspired_Chaos
 
Posts: 3
Joined: Sat Jul 11, 2020 12:18 pm

Re: Adafruit_Seesaw library support for other I2C busses.

by adafruit_support_carter on Mon Jul 13, 2020 2:52 pm

Try passing in a reference to your other I2C bus when creating the NeoTrellis instance:
Code: Select all | TOGGLE FULL SIZE
Adafruit_NeoTrellis trellis(&Wire);

replace Wire with whatever your I2C bus instance is.

To set a non-default address, do that in begin():
Code: Select all | TOGGLE FULL SIZE
  if (!trellis.begin(0x2E)) {

replace 0x2E with whatever the address is.

adafruit_support_carter
 
Posts: 16820
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit_Seesaw library support for other I2C busses.

by Inspired_Chaos on Mon Jul 13, 2020 6:50 pm

My Neo Trellis shows up in the Wire library's scanner example at address 2e when I modify the code to point to Wire1. however; in the Trellis "Basic" example I changed the instance creation to:

I used Adafruit_NeoTrellis trellis(&Wire1);

Unfortunately I'm still getting "Could not start trellis, check wiring?" in the serial monitor and no illumination on the trellis buttons. Here's the full code of the basic example with the line I modified:

Code: Select all | TOGGLE FULL SIZE
/* This example shows basic usage of the NeoTrellis.
  The buttons will light up various colors when pressed.
  The interrupt pin is not used in this example.
*/

#include "Adafruit_NeoTrellis.h"


Adafruit_NeoTrellis trellis(&Wire1);
//define a callback for key presses
TrellisCallback blink(keyEvent evt){
  // Check is the pad pressed?
  if (evt.bit.EDGE == SEESAW_KEYPAD_EDGE_RISING) {
    trellis.pixels.setPixelColor(evt.bit.NUM, Wheel(map(evt.bit.NUM, 0, trellis.pixels.numPixels(), 0, 255))); //on rising
  } else if (evt.bit.EDGE == SEESAW_KEYPAD_EDGE_FALLING) {
  // or is the pad released?
    trellis.pixels.setPixelColor(evt.bit.NUM, 0); //off falling
  }

  // Turn on/off the neopixels!
  trellis.pixels.show();

  return 0;
}

void setup() {
  Serial.begin(9600);
  //while(!Serial);
 
  if (!trellis.begin()) {
    Serial.println("Could not start trellis, check wiring?");
    while(1);
  } else {
    Serial.println("NeoPixel Trellis started");
  }

  //activate all keys and set callbacks
  for(int i=0; i<NEO_TRELLIS_NUM_KEYS; i++){
    trellis.activateKey(i, SEESAW_KEYPAD_EDGE_RISING);
    trellis.activateKey(i, SEESAW_KEYPAD_EDGE_FALLING);
    trellis.registerCallback(i, blink);
  }

  //do a little animation to show we're on
  for (uint16_t i=0; i<trellis.pixels.numPixels(); i++) {
    trellis.pixels.setPixelColor(i, Wheel(map(i, 0, trellis.pixels.numPixels(), 0, 255)));
    trellis.pixels.show();
    delay(50);
  }
  for (uint16_t i=0; i<trellis.pixels.numPixels(); i++) {
    trellis.pixels.setPixelColor(i, 0x000000);
    trellis.pixels.show();
    delay(50);
  }
}

void loop() {
  trellis.read();  // interrupt management does all the work! :)
 
  delay(20); //the trellis has a resolution of around 60hz
}


/******************************************/

// 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 trellis.pixels.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return trellis.pixels.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return trellis.pixels.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  return 0;
}


According to the IDE I am using version 1.3.0 of the Adafruit_Seesaw package. Thanks for your help!

Inspired_Chaos
 
Posts: 3
Joined: Sat Jul 11, 2020 12:18 pm

Re: Adafruit_Seesaw library support for other I2C busses.

by adafruit_support_carter on Wed Jul 15, 2020 12:26 pm

Hmm. OK, so might not work as expected.

Want to open an issue in the repo to request that feature?
https://github.com/adafruit/Adafruit_Seesaw

adafruit_support_carter
 
Posts: 16820
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.