I am doing a project with nextion and everything works correctly, but when I include the progress bar the data transmission slows down.
everything included maybe use additional ressources ... ?
maybe ressources are not endless available ... ?
maybe included is used wrong at the wrong time ... ?
many maybes possible ...
The code of the progress bar is it:
short int percent; percent=rpm*100/shift_rpm; Serial2.print("j0.val="); //variable de la pantalla que se va a modificar Serial2.print(percent); //manda el valor optenido del potenciometro ff();
From Nextion standpoint this is not slow
- 12 bytes average at 9600 baud 12.5ms or 1.04ms at 115200 baud.
Not your source of any slowdown.
I'm guessing from the variable names in the very short code snippet you provide, that you are trying to represent an animated graphical tachometer with the progress bar?
If, as I suspect, you are running that code every iteration of loop() then it's no surprise things are 'slowing' down.
You need a 'sample value per period' approach to give the desired effect.
I would think 20 values per second would be plenty in this case, and possibly as little as 15 would still look quite fluid.
That would mean you only need to send to Nextion every 50ms or more, giving plenty of time in between for your MCU to do other stuff :)
So few details
Yes it is. Is a graphical tachometer with the progress bar.
How I can send to nextion the data every 50ms?
ok I just tried and it works correctly.