# Interface with encoder

**URL:** <https://discourse.processing.org/t/interface-with-encoder/13937>\
**Category:** Processing for Pi\
**Created:** [September 11, 2019, 11:52pm UTC](https://discourse.processing.org/t/interface-with-encoder/13937 "2019-09-11T23:52:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephanschulz](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@stephanschulz](https://discourse.processing.org/u/stephanschulz)\
**Post date:** [September 11, 2019, 11:52pm UTC](https://discourse.processing.org/t/interface-with-encoder/13937/1 "2019-09-11T23:52:27Z")

</div>

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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![stephanschulz](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@stephanschulz](https://discourse.processing.org/u/stephanschulz)\
**Post date:** [September 12, 2019, 12:02am UTC](https://discourse.processing.org/t/interface-with-encoder/13937/2 "2019-09-12T00:02:59Z")

</div>

I guess this would be good to use

```auto
  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](https://processing.org/reference/libraries/io/GPIO_interrupts_.html)
