Pico Feather w/ seesaw encoder

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
me_is_pete
 
Posts: 3
Joined: Sat Oct 16, 2021 9:36 pm

Pico Feather w/ seesaw encoder

Post by me_is_pete »

I can see the seesaw rotary encoder module (via a stemma connector) just fine from circuit python but not when using the Arduino interface. It seems that I need to tell the seesaw library to look for Wire1 or change the SDA/SCL pins assignments?

Has anybody done this?

I tired adding a few lines to the basic_encode in examples:

#include <Wire.h>
#include "Adafruit_seesaw.h"
#include <seesaw_neopixel.h>
Adafruit_seesaw ss(&Wire1);

Never seems to find the seesaw device.

Works fine on circuit python and a M4 feather express - what am I missing?

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Pico Feather w/ seesaw encoder

Post by adafruit_support_carter »

Can you get the board to show up in an I2C scan?
https://learn.adafruit.com/scanning-i2c ... es/arduino

User avatar
me_is_pete
 
Posts: 3
Joined: Sat Oct 16, 2021 9:36 pm

Re: Pico Feather w/ seesaw encoder

Post by me_is_pete »

Thank you!

When I define WIRE to Wire1 I see it (thanks)

18:17:42.509 -> Scanning...
18:17:42.550 -> I2C device found at address 0x36 !
18:17:42.550 -> done

I have a rp2040 feather w/ the encoder connected to the stemma port (nothing else).

I followed the instructions to get the board and libraries through the Arduino interface and am just using the the basic_encoder example.

There isn't an obvious way to define the Wire channel in this simple example.

I thought that it would be when the object is defined?

#include "Adafruit_seesaw.h"
#include <seesaw_neopixel.h>
#define SEESAW_ADDR 0x36
Adafruit_seesaw ss;

Thanks for your guidance!

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Pico Feather w/ seesaw encoder

Post by adafruit_support_carter »

OK, at least we know it can be seen. So we know basic connections are OK.

What you showed in your first post *should* be how to specify Wire1 as the I2C bus to use:

Code: Select all

Adafruit_seesaw ss(&Wire1);
When you run the encoder_basic example,
https://github.com/adafruit/Adafruit_Se ... _basic.ino
modified with the line of code above to use Wire1, what gets printed in the Serial Monitor?

User avatar
me_is_pete
 
Posts: 3
Joined: Sat Oct 16, 2021 9:36 pm

Re: Pico Feather w/ seesaw encoder

Post by me_is_pete »

I got "Couldn't find seesaw on default address"

I modified the seesaw constructor (Adafruit_seesaw.cpp) from:

Code: Select all

Adafruit_seesaw::Adafruit_seesaw(TwoWire *i2c_bus) {
   if (i2c_bus == NULL) {
     _i2cbus = &Wire;
   } else {
     _i2cbus = i2c_bus;
   }
}
to:

Code: Select all

Adafruit_seesaw::Adafruit_seesaw(TwoWire *i2c_bus) {
  if (i2c_bus == NULL) {
#if defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
	  _i2cbus = &Wire1;
#else
    _i2cbus = &Wire;
#endif
  } else {
    _i2cbus = i2c_bus;
  }
}
}
That works!

Does that means that Wire1 is still NULL when it get's passed to the constructor? So _i2cbus goes back to Wire?

I'm happy w/ this but is there a more appropriate way?

Thanks again!

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Pico Feather w/ seesaw encoder

Post by adafruit_support_carter »

That is weird. Just to be sure, you're still creating the seesaw object like this?

Code: Select all

Adafruit_seesaw ss(&Wire1);
That should end up being not NULL and using Wire1.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”