Using the Beetle ESP32 - C3 with the Gravity Lightning Distance Sensor
I'm building a project using the Beetle ESP32 - C3 with the Gravity Lightning Distance Sensor and I have a question about the Interrupt. In the sample code, there's the following:
```
#if defined(ESP32) || defined(ESP8266)
#define IRQ_PIN 0
#else
#define IRQ_PIN 2
#endif
```
My question is why? What's different about the ESP32 that it requires a specific interrupt assignment.
Looking at the pinouts here: https://wiki.dfrobot.com/SKU_DFR0868_Beetle_ESP32_C3. Does that mean I connect the IRQ connection to Pin 0 in the upper left corner in the pinout image? Can't I use any of the GPIO pins for interrupt?
I spent some time looking into this and as far as I can tell, there's nothing special about the ports you use. It appears that the example shown above is just an artifact of the sample developer's hardware configuration (likely because he tested the hardware using the sketch on multiple microcontrollers).
As I understand it from some research I did the ESP32 supports 16 IRQ channels and they're software assignable to any GPIO port as the sample shows. I submitted a PR (https://github.com/DFRobot/DFRobot_AS3935/pull/14) to change the sample to the following:
// Connect the license sensor's IRQ pin to a GPIO pin on the microcontroller
// then replace the number below with the GPIO pin number
#define IRQ_PIN 2