Start a new topic

Why does the progress bar slow data transmission?

Hi everybody!


I am doing a project with nextion and everything works correctly, but when I include the progress bar the data transmission slows down.

 

why?

 

regards


everything included maybe use additional ressources ... ? 

maybe ressources are not endless available ... ?

maybe included is used wrong at the wrong time ... ?


many maybes possible ...


1 person likes this

 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

 - j0.val=45ÿÿÿ 

 - 12 bytes average at 9600 baud 12.5ms or 1.04ms at 115200 baud.


Not your source of any slowdown.

 

@urchaga90


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 :)  



1 person likes this

So few details

@indev2


Yes it is. Is a graphical tachometer with the progress bar. 


How I can send to nextion the data every 50ms?


Kind regars

millis()


1 person likes this


ok I just tried and it works correctly.


Kind Regards

Login or Signup to post a comment