Hello everyone, I'm building a weather station and I'm trying to connect a rain gauge to the Arduino GIGA R1. The rain gauge is a device used to measure rainfall; it sends an electrical pulse to the Arduino, which is read through a digital output. To capture that digital signal, I used an interrupt. The issue I'm facing is that the Arduino GIGA R1 doesn't seem to capture the interrupt or I don't know what might be happening. I tested this same code and connection with the Arduino Uno, the ESP32, and the Arduino Mega, and it works fine. The problem appears to be specific to the Arduino GIGA; it's as if nothing is connected.
I'll briefly explain the code I used. The first thing I did was define a variable, 'counter,' and the interrupt pin. Inside the setup() method, I declared the interrupt. Finally, I declared a method called 'LitersCounter,' which runs each time the sensor sends a digital signal. This method counts the number of pulses sent by the Arduino GIGA.
The connection involves attaching one cable from the sensor to GND and another to a digital pin. It's straightforward. If you want to know more, I based this on the information in this Spanish video: https://youtu.be/hvD2rsqDduU. The connection is shown at the 3:06 mark.
int ISRCounter=0;
const byte interruptPin = 3;
void setup() {
pinMode( interruptPin , INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin),LitersCounter, RISING);
Serial.begin(9600);
}
void LitersCounter(){
ISRCounter++;
Serial.println(ISRCounter);
}
void loop() {
// put your main code here, to run repeatedly:
}
According to the documentation, I can use any GPIO pin for an interrupt; you can check it here, it's towards the bottom: https://docs.arduino.cc/tutorials/giga-r1-wifi/cheat-sheet