Interface with encoder

I am very excited to translate some of my older projects to processing for PI.

In the past I used a call like this to monitor the 2 digital pins of my encoder:

wiringPiISR (encoderPinA,INT_EDGE_BOTH, &handleInterrupt);
wiringPiISR (encoderPinB,INT_EDGE_BOTH, &handleInterrupt);

And then check the handleInterrupt() function for pin changes.
Is there any way of doing this in processing PI?

1 Like

I guess this would be good to use

  GPIO.pinMode(4, GPIO.INPUT);
  GPIO.pinMode(5, GPIO.INPUT);
  GPIO.attachInterrupt(4, this, "pinEvent", GPIO.RISING);
  GPIO.attachInterrupt(5, this, "pinEvent", GPIO.RISING);

as per the example
https://processing.org/reference/libraries/io/GPIO_interrupts_.html