My arduino sends "1" on serial at each pulse. I want to count the number of pulses on Processing. Sometimes the number is incremented twice, what can I do ?
My code :
// if Arduino sent something on the console, increment the 2 counters
if(myPort.available() > 0)
{
myPort.clear();
counter++;
counterByHour++;
println(counter);
// Arduino sends "on", so there are more caractere,