Nextion Screen Data transmition

Hi,

I am using a Nextion screen to comunicate with my arduino for the first time.
For the moment it works fine with the comunication from the screen to the Arduino but my problem is when I need to send information with the screen.

void velocidadpura(){
  analogWrite(Q07,puntosvelocidad);
  puntosvelocidadnextion=map(puntosvelocidad,0,255,0,360);
  //const String contometro=("z0.val=");
  String stringpuntovelocidad=String(puntosvelocidadnextion);
  //Serial1.print("7A 30 2E 76 61 6C 3D 31 30 30 ff ff ff");//z0.val=100
  Serial1.print("z0.val=");
  //Serial1.print(stringpuntovelocidad);
  Serial1.print(puntosvelocidadnextion);
}

I tried in many ways to transmit the data but none of them works. Basicaly i am trying to send an integer to move a jauge.

Thanks.

I tried in many ways to transmit the data but none of them works.

Sure they do. They may not do what you want, but that does not mean that they don't work.

The fine folks at http://snippets-r-us.com will be happy to help you with your snippets.

Sure Paul, It transmits but doesn't do what I would like.
Do you have any idea ?

Do you have any idea ?

Yes, and I posted a link that explains it.

I take it Serial1 is a software serial
Port , or second port on a Mega ( or whatever) , correctly wired and set at 9600 baud.

Have you looked at the Nextion instruction set for this ?

Serial1.print (“zO.val=“);
Serial1.print(X);
Serial1.print (0xff);
Serial1.print (0xff);
Serial1.print( 0xff);

Where X is your int variable .
Watch out for spaces , eg it won’t work with a space after =.

This is not using the Nextion.h library, which has it’s own commands.

Thank you @Hammy you were correct, I was forgetting to include the three 0xFF.

:slight_smile: