I'm sorry but English is not my native language
I wanted to say that I would use teensy libraries but that it would not be necessary to use programs like jinx or glediator
my project is a chronometer activated by sensors and that can be seen in the matrix
this is a simple code that I did for the serial monitor with an arduino I do not know if this code would be valid with teensy
Thank you
boolean contando = false;
boolean detenido = false;
unsigned long lock;
unsigned long tInicio;;
unsigned long tParada;
unsigned long temp;
void setup() {
Serial.begin(9600);
pinMode(4, INPUT);
}
void loop() {
if (digitalRead(4) && lock+3000<millis()) {
if (contando) {
tParada = millis(); // Momento en que la cuenta se detuvo
contando = false;
detenido = true;
}
else {
tInicio = millis();
contando = true;
detenido = false;
}
lock = millis();
}
if (contando == true || detenido) {
if (temp + 50 < millis()) {
tParada = millis();
mostrarTiempo();
detenido = false;
temp = millis();
}
}
}
void mostrarTiempo() {
unsigned long lapso = tParada - tInicio;
unsigned int mseg = lapso % 1000;
lapso /= 1000;
byte seg = lapso % 60;
lapso /= 60;
byte min = lapso % 60;
unsigned int hr = lapso / 60;
char tiempo[20];
sprintf(tiempo, "%02d:%02d:%02d.%03d",
hr, min, seg, mseg); // Convertir a texto los resultados
Serial.print (contando);
Serial.print (" ");
Serial.println(tiempo);
// Debería imprimir el tiempo en formato hh:mm:ss.msmsms (milisegundos con tres dígitos)
}
[code]