Skip to content

Multiple encoders #21

@Gandrasg

Description

@Gandrasg

Hi!
Can you help? I don't fully understand how to assign tasks by ID for multiple encoders.
If I use multiple encoders, how do I request information for a particular encoder? How can I associate behavior with an ID. For example: If the encoder ID is X, do you do it, and if the encoder ID is Y, do you do it?

void encoder_rotated(i2cEncoderLibV2* obj) {
  if (obj->readStatus(i2cEncoderLibV2::RINC))
    Serial.print("Increment ");
  else
    Serial.print("Decrement ");
  Serial.print(obj->id);
  Serial.print(": ");
  Serial.println(obj->readCounterInt());
  "if the ID = 0" writeRGBCode(0x0000FF);
  "if the ID = 1" writeRGBCode(0x00FF00);
}

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions