hi
i got cheap tipping bucket rain gauge off ebay. when bucket tips, 2 attached wires connects around half second. i'd count event.
browsing around got me interested in interrupt function can't quite working. recon uno uses pin2 interrupt 0 , experimented both 3.3v, 5v , gnd other 1 - rising/falling.
i use code:
running types me zero. other times gives me example 151, 300, 450 etc. counting? 50 hz 3 seconds? sounds grid ac in house.
if tip bucket, counting stops in middle position, other times nothing happens.
how can make 1 tip (perhaps 500ms connection) count +1? plan on making rain guage count millimeters of water.
thanks in advance,
chris
i got cheap tipping bucket rain gauge off ebay. when bucket tips, 2 attached wires connects around half second. i'd count event.
browsing around got me interested in interrupt function can't quite working. recon uno uses pin2 interrupt 0 , experimented both 3.3v, 5v , gnd other 1 - rising/falling.
i use code:
code: [select]
int x = 0;
void setup() {
attachinterrupt(0, increment, rising);
serial.begin(9600);
}
void loop() {
delay(3000);
serial.println(x, dec);
}
void increment() {
x++;
}
running types me zero. other times gives me example 151, 300, 450 etc. counting? 50 hz 3 seconds? sounds grid ac in house.
if tip bucket, counting stops in middle position, other times nothing happens.
how can make 1 tip (perhaps 500ms connection) count +1? plan on making rain guage count millimeters of water.
thanks in advance,
chris
well, browsed wrong places. interrupt not way handle such slow event. problem switch not de-bounced. have whether done interrupt or not.
Arduino Forum > Using Arduino > Programming Questions > Counting rain with tipping bucket
arduino
Comments
Post a Comment