Using Arduino Uno D19 pin as D2 pin - Interrupt

Hello. I am using a 2.4 inch tft display with Arduino Uno. I need to show the data I get from a sensor on the screen, so I need the D2 pin. The TFT display occupies all digital interrupt pins. It was written in the forums that I could move the D2 pin to another pin, but I could not understand how to do it. I want to move it to D19.

mcufriend.h is the lcd library.

Thank you!

The EnableInterrupt library which can use both normal interrupts and PCINT interrupts: https://github.com/GreyGnome/EnableInterrupt

1 Like

Why? Which sensor are you using?

The other question is if the TFT is indeed using D2.

An Uno has 14 digital pins and 6 analog pins; the latter can be used as digital as well. There is no digital pin D19 unless you're referring to A5.

Is your TFT using SPI or I2C for communication? If the latter, you can not use A5 for your sensor as it also carries one of the I2C signals.

1 Like

The "PinChangeInterrupt" library by NicoHood will let you use any pin on the UNO for an interrupt. It works very similarly to the External Interrupt support built into Arduino:

attachPinChangeInterrupt(digitalPinToPinChangeInterrupt(pin), ISR, CHANGE/RISING/FALLING);
2 Likes

@johnwasser Thank you very much for your help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.