I am playing note tone with CapacitiveSensor and an output of tone like this
void loop() {
time_before = millis();
long total1 = cs_2_3.capacitiveSensor(30);
long total2 = cs_2_4.capacitiveSensor(30);
if((total1>200)||(total2>200)) {
if(total1>200) {
tone(12,261);
time_after = millis();
Serial.print("Time: ");
Serial.println(time_after-time_before);
}
if(total2>200) {
tone(12,294);
time_after = millis();
Serial.print("Time: ");
Serial.println(time_after-time_before);
}
}
}
How can I read how many seconds I play this note par example