I expose my question I am doing a led matrix of 100 x 40 led using teenzy3.2 with the octows2812 adapter I have seen that with programs like jinx or glediator one could control the matrix but I want to control the matrix to place a chronometer without the help of any external program only with the millis function would it be possible to do it?
PaulRB:
You mean drive the ws2812 strings without using any library? Why?
Well he seems not to know where the full stop key is on his keyboard so perhaps he has difficulty with other punctuation marks which can make some programming difficult.
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]