Hi,
I am trying to use a rain gauge (https://images.app.goo.gl/cMo9FG6oEzXPDaTc7) with Arduino UNO WiFi rev2. The rain gauge works using reed switch. I tried to dowload the sketch attached to Arduino UNO R3 and it works fine.
I compiled the same program with the UNO WIFI Rev2. No problem.
I downloaded it on the card, always OK. A launch the sketch, it seem to work; but nothing happens.
I have already delete "digitalPinToInterrupt" in the line attachInterrupt(2, Basculata, FALLING);.
Are there any other errors? Maybe I have to change some settings on Arduino IDE?
Why doesn't it work?
Thanks in advance
#include <SPI.h>
float TotPioggia = 0;
int nbasculata = 0;
int conto;
boolean blnWrite=false;
void setup()
{
Serial.begin(9600);
Serial.println("Start");
attachInterrupt(2, Basculata, FALLING); //LOW CHANGE RISING FALLING
}
void loop()
{
interrupts();
delay(1000);
if (blnWrite==1)
{
blnWrite=false;
Serial.println("Pioggia mm: " + (String)TotPioggia);
delay(50);
conto = nbasculata/3;
Serial.println("Numero basculata: " + (String)conto);
delay(50);
Serial.println("--------------------------");
delay(50);
}
}
void Basculata()
{
noInterrupts();
//TotPioggia = TotPioggia + 0.3;
nbasculata++;
TotPioggia = (nbasculata/3)*0.3;
delay(500);
blnWrite=true; //segnalo che è avvenuta una basculata
}