Serial detection
in
Integration and Hardware
•
9 months ago
Hello,
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,
- // this clear the variable
- myPort.clear();
- }
1