Closed matthewepler closed 1 year ago
The error was a fluke. I power-cycled the board and it worked fine...with one exception in the above code. The argument encoderId
in the call to getEncoderDelta
should not be there. The function should be called with no argument: int32_t delta = ss.getEncoderDelta();
.
Along the way to this conclusion, I learned a few things by trial/error that are not clearly stated in the docs and could be of use to someone else trying to figure out how to use this function...
The function definition for getEncoderDelta
includes a parameter encoder
(Adafruit_seesaw.cpp
, line 784). It's unclear from the docstring what this refers to and how it should be used. This argument is meant target a single encoder when more than one encoder is attached to your I2C. A value of 1
would refer to the encoder whose address is 1 value more than the default encoder address (aka SEESAW_BASE_ADDR
in the library code).
If you only have one encoder, you don't need any argument when calling getEncoderDelta
. If you have two, then calling it with no argument or 0
will address the first encoder, and 1
address the second. And so on.
In short, it's just a number added to the base address and has no meaning by itself.
Steps taken:
Expected result: serial monitor prints "2" when knob turned left and "-2" in the opposite direction. Actual result: serial monitor prints "2" in both directions
Description: The function def for
getEncoderDelta
should returned a signed integer. I am only seeing positive values. Either I'm using the function wrong or this is a bug.Sketch: