Go Down

Topic: Problem with reading data from Nextion (Read 849 times) previous topic - next topic

TheRafal

Hi, i've a 7.0" enhanced display from nextion that i want to use with a Mega.

Because i've troubles with it, i try this tuto on a nano with the display https://www.youtube.com/watch?v=mdkUBB60HoI

I use the exact same files (ino and hmi, library in description also), with no modifications.

The data from arduino to nextion work.
If i use the debug with the serial MCU input and both screen connected, when i change page in debug it change values on screen but if i change on screen, nothing happen... (Debug or not).

If i unplug the blue wire (TX from screen) counter from arduino stop. (same with the yellow but it's normal)

I also check the voltage on TX Screen, 5V, But i can't check if it send data or not.

Thank you for your help ;)

PerryBebbington

Hello Rafal,

Please read 'how to use this forum - please read' (big clue in the title) and follow the instructions. A the moment all we have to go on is a vague description and a link to a video. Please post the things suggested in the forum instructions, you are more likely to get a helpful answer that way.

Thank you.

TheRafal

To try to be more clear and more "Rules complient"

Code: [Select]

#include <Nextion.h>

int variable1 = 0;
int counter = 0;
int CurrentPage = 0;


NexButton b1 = NexButton(0, 9, "b1");  // Button added
NexButton b0 = NexButton(0, 1, "b0");  // Button added
NexButton b4 = NexButton(0, 11, "b4");  // Button added
NexDSButton bt0 = NexDSButton(0, 8, "bt0");  // Dual state button added
NexSlider h0 = NexSlider(0, 4, "h0");  // Slider added
NexText t5 = NexText(2, 12, "t5");  // Text box added, so we can read it
NexText t6 = NexText(2, 13, "t6");  // Text box added, so we can read it
NexText t7 = NexText(2, 14, "t7");  // Text box added, so we can read it
NexRadio r0 = NexRadio(2, 4, "r0");  // Radio checkbox added
NexRadio r1 = NexRadio(2, 5, "r1");  // Radio checkbox added
NexRadio r2 = NexRadio(2, 6, "r2");  // Radio checkbox added
NexCheckbox c0 = NexCheckbox(2, 3, "c0");  // Checkbox added
NexButton j0 = NexButton(2, 2, "j0");  // Progress bar as a button added, so if we press the progress bar we can create an action
NexButton b21 = NexButton(2, 10, "b21");  // Button added
NexButton b22 = NexButton(2, 16, "b22");  // Button added
NexButton b23 = NexButton(2, 18, "b23");  // Button added
NexButton b24 = NexButton(2, 19, "b24");  // Button added

// Declare pages:
NexPage page0 = NexPage(0, 0, "page0");  // Page added as a touch event
NexPage page1 = NexPage(1, 0, "page1");  // Page added as a touch event
NexPage page2 = NexPage(2, 0, "page2");  // Page added as a touch event

// End of declaring objects


char buffer[100] = {0};


NexTouch *nex_listen_list[] =
{
  &b1,  // Button added
  &b0,  // Button added
  &b4,  // Button added
  &b21,  // Button added
  &b22,  // Button added
  &b23,  // Button added
  &b24,  // Button added
  &bt0,  // Dual state button added
  &h0,  // Slider added
  &r0,  // Radio checkbox added
  &r1,  // Radio checkbox added
  &r2,  // Radio checkbox added
  &c0,  // Checkbox added
  &j0,  // Progress bar as a button added
  &page0,  // Page added as a touch event
  &page1,  // Page added as a touch event
  &page2,  // Page added as a touch event
  NULL  // String terminated
};


void b1PushCallback(void *ptr)
{
  digitalWrite(13, HIGH);
}


void b1PopCallback(void *ptr)
{
  digitalWrite(13, LOW);
}


void b0PushCallback(void *ptr)
{
  counter = counter - 1;

  Serial.print("n3.val=");
  Serial.print(counter);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void b4PushCallback(void *ptr)
{
  counter = counter + 1;

  Serial.print("n3.val=");
  Serial.print(counter);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void bt0PopCallback(void *ptr)
{
  uint32_t number5 = 0;
  bt0.getValue(&number5);

  if(number5 == 1){
    digitalWrite(13, HIGH);
  }else{
    digitalWrite(13, LOW);
  }
}


void h0PopCallback(void *ptr)
{
  uint32_t number2 = 0;
  h0.getValue(&number2);
 
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }

  Serial.print("n4.val=");
  Serial.print(number2);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}



void r0PushCallback(void *ptr)
{
  Serial.print("n9.val=");
  Serial.print(1);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void r1PushCallback(void *ptr) 
{
  Serial.print("n9.val=");
  Serial.print(2);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void r2PushCallback(void *ptr)
{
  Serial.print("n9.val=");
  Serial.print(3);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void c0PushCallback(void *ptr)
{
  uint32_t number3 = 0;
  c0.getValue(&number3);
  Serial.print("n1.val=");
  Serial.print(number3);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void j0PushCallback(void *ptr)
{
  Serial.print("j0.pco="); 
  Serial.print(63488);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void b21PushCallback(void *ptr)
{
  Serial.print("page 0");
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);




void b22PushCallback(void *ptr)
{
  memset(buffer, 0, sizeof(buffer));
  t5.getText(buffer, sizeof(buffer));

  Serial.print("t23.txt=");
  Serial.print("\"");
  Serial.print(buffer);
  Serial.print("\"");
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}



void b23PushCallback(void *ptr)
{
  memset(buffer, 0, sizeof(buffer));
  t6.getText(buffer, sizeof(buffer));

  Serial.print("t23.txt=");
  Serial.print("\"");
  Serial.print(buffer);
  Serial.print("\"");
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}



void b24PushCallback(void *ptr)
{
  memset(buffer, 0, sizeof(buffer));
  t7.getText(buffer, sizeof(buffer));

  Serial.print("t23.txt=");
  Serial.print("\"");
  Serial.print(buffer);
  Serial.print("\"");
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}

void page0PushCallback(void *ptr)
{
  CurrentPage = 0;
}

void page1PushCallback(void *ptr)
{
  CurrentPage = 1;
}


void page2PushCallback(void *ptr) 
{
  CurrentPage = 2;


void setup() {
 
  Serial.begin(512000);

  b1.attachPush(b1PushCallback);
  b1.attachPop(b1PopCallback);
  b0.attachPush(b0PushCallback);
  b4.attachPush(b4PushCallback);
  b21.attachPush(b21PushCallback);
  b22.attachPush(b22PushCallback);
  b23.attachPush(b23PushCallback);
  b24.attachPush(b24PushCallback);
  bt0.attachPop(bt0PopCallback); 
  h0.attachPop(h0PopCallback);
  r0.attachPush(r0PushCallback);
  r1.attachPush(r1PushCallback);
  r2.attachPush(r2PushCallback);
  c0.attachPush(c0PushCallback);
  j0.attachPush(j0PushCallback); 
  page0.attachPush(page0PushCallback);
  page1.attachPush(page1PushCallback); 
  page2.attachPush(page2PushCallback); 


  pinMode(13, OUTPUT);

}

void loop() {

  delay(30); 

  variable1++;
  if(variable1 > 240){
    variable1 = 0;
  }

  Serial.print("n0.val=");
  Serial.print(variable1);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);

  Serial.print("np.val=");
  Serial.print(CurrentPage);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);


  if(CurrentPage == 0){
 
    Serial.print("t1.txt=");
    Serial.print("\"");
    Serial.print("Hello!");
    Serial.print("\"");
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
  }

  if(CurrentPage == 1){ 
    Serial.print("add 2,0,");
    Serial.print(variable1);
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
  }


    Serial.print("z0.val=");
    Serial.print(variable1);
    Serial.write(0xff); 
    Serial.write(0xff);
    Serial.write(0xff);
 
  }

  nexLoop(nex_listen_list);


It's the code in the descriptions of the video i use to try to understand my problem. I also use the HMI file give by the guy. I try the "Custom library" from Author also, without result.

So, my problem is, i think my screen don't send data to arduino.

I check voltage, 5V.

I use debug to test HMI solution, work well. If i use debug with MCU input and my arduino, the debug send data to arduino, arduino do the tricks and send back data to debug screen. It work well.

If i connect the screen at the same time as debug, on screen the page change, values changes etc... But, if i click on the screen button nothing happen (except change page)...

For details, i try with 3 diffrents Nano and One Mega (only on serial, others serial doesn't work...).

My Connection was good also.

Is it more clear you think Perry ?

Thank you in advance  ;)

PerryBebbington

#3
Nov 17, 2019, 08:28 pm Last Edit: Nov 17, 2019, 08:29 pm by PerryBebbington
Hello Rafal,

That's a bit better.

I do not use the Nextion libraries so any help I can give will be limited. I am aware that the libraries from ITEAD are full of bugs, if you go to Ray Livingston's Nextion libraries   you can download an improved version with most of the bugs removed.


Quote
I use debug to test HMI solution, work well. If i use debug with MCU input and my arduino, the debug send data to arduino, arduino do the tricks and send back data to debug screen. It work well.
I don't know what this means, sorry. The only debug I am aware of is in the Nextion editor and it doens't send data to an Arduino and it doesn't receive data from one either. You must be using something I am not aware of.

I get the impression from reading your post that you don't clearly understand the code you are using, is this true? Do you understand C/C++ at all? Do you understand the Nextion language and commands? The impression I have is that you are using a demonstration without understanding it. If this is the case you need to learn the basics first.

I have a tutorial on this site Using Nextion displays with Arduino , which might help you, but be aware that to use my methods you need to understand C (not necessarily C++) and some of the Nextion language. However, I can be a lot more helpful with my own methods than I can with the Nextion libraries. 






TheRafal

#4
Nov 17, 2019, 09:17 pm Last Edit: Nov 17, 2019, 09:30 pm by TheRafal
Thank you Perry for the link of library. I'll Check it tomorow. Maybe it can help me.

For the debug, yes i talk about Nextion Editor debug. On this window, in the bottom, you have 3 textboxes, One for input string or hex, one for the output simulate by the emulator and the läßt one called MCU. This one is what the arduino send over Serial via USB (only Serial, not 1,2,3 because it send also on USB) to the Computer. Then the nextion Editor read this input and simulate the changes arduino send. Also, if you test a button on Simulator, you See in output an Hex code. That code is send over Serial via USB If you activate MCU input (bottom left of window).

For your last question, yes i know C/C++ and i completly understand the Code i Post... Maybe it's because i've difficults to explain. I'm french and maybe my englisch is not very clear for you. I understand, the nextion langage too, but with my knowledges i don't understand why, when i put the exact same files i don't have the same result. I test with this file to try understand why my personal Code doesnt work and to find my possible mistake.

So, i'll test your library tomorow, and check if it work.

Thank you for your links (library and tuto, always helpfull)

Edit: i've already try the Updates library without result. I try another time with your Demo tomorow.
I've also see in your tuto, your Serial data send from screen (blue wire) is 3V, mine is 5V. Maybe it's the problem...

Seithan

With a first look I can see that

Code: [Select]
void setup() {
 
  Serial.begin(512000);

Why you use such a high speed? is Nextion set to the same baud ?
You better try 9600 as the default of Nextion
You can find help for the settings of the baud rate here: How to initialize Nextion's Serial baud rate:

Code: [Select]
Serial.print("np.val=");
  Serial.print(CurrentPage);


There can't be a component with objectname 'np' , unless you have changed it. I am guessing it is either n9. Perhaps you mean something else?

Code: [Select]
if(CurrentPage == 0){
 
    Serial.print("t1.txt=");
    Serial.print("\"");
    Serial.print("Hello!");
    Serial.print("\"");
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
  }

  if(CurrentPage == 1){
    Serial.print("add 2,0,");
    Serial.print(variable1);
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
  }


    Serial.print("z0.val=");
    Serial.print(variable1);
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
 
  }

  nexLoop(nex_listen_list);


The loop for the nextion listen list is out of the main loop so, it never is executed
Code: [Select]
nexLoop(nex_listen_list);

Also an if statement must be missing from here:

Code: [Select]
Serial.print("z0.val=");
    Serial.print(variable1);
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
 
  }


Maybe the correct is this

Code: [Select]
if(CurrentPage == 2){
    Serial.print("z0.val=");
    Serial.print(variable1);
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
 
  }

  nexLoop(nex_listen_list);
  }

Make sure that the last } under   nexLoop   is there to include the nexLoop into the main loop

In the void below the same if statement is repeated many many times

Code: [Select]
void h0PopCallback(void *ptr)
{
  uint32_t number2 = 0;
  h0.getValue(&number2);
 
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }
  if(number2==0){
    h0.getValue(&number2);
  }




UBUNTU:
"I am what I am, because of who we all are", compassion, kindness and humanity that connect us together by sharing  ourselves with others and caring for those around us.

Seithan

#6
Nov 17, 2019, 09:40 pm Last Edit: Nov 17, 2019, 11:38 pm by Seithan
After those corrections, your code should look something like this:
Code: [Select]


#include <Nextion.h>

int variable1 = 0;
int counter = 0;
int CurrentPage = 0;


NexButton b1 = NexButton(0, 9, "b1");  // Button added
NexButton b0 = NexButton(0, 1, "b0");  // Button added
NexButton b4 = NexButton(0, 11, "b4");  // Button added
NexDSButton bt0 = NexDSButton(0, 8, "bt0");  // Dual state button added
NexSlider h0 = NexSlider(0, 4, "h0");  // Slider added
NexText t5 = NexText(2, 12, "t5");  // Text box added, so we can read it
NexText t6 = NexText(2, 13, "t6");  // Text box added, so we can read it
NexText t7 = NexText(2, 14, "t7");  // Text box added, so we can read it
NexRadio r0 = NexRadio(2, 4, "r0");  // Radio checkbox added
NexRadio r1 = NexRadio(2, 5, "r1");  // Radio checkbox added
NexRadio r2 = NexRadio(2, 6, "r2");  // Radio checkbox added
NexCheckbox c0 = NexCheckbox(2, 3, "c0");  // Checkbox added
NexButton j0 = NexButton(2, 2, "j0");  // Progress bar as a button added, so if we press the progress bar we can create an action
NexButton b21 = NexButton(2, 10, "b21");  // Button added
NexButton b22 = NexButton(2, 16, "b22");  // Button added
NexButton b23 = NexButton(2, 18, "b23");  // Button added
NexButton b24 = NexButton(2, 19, "b24");  // Button added

// Declare pages:
NexPage page0 = NexPage(0, 0, "page0");  // Page added as a touch event
NexPage page1 = NexPage(1, 0, "page1");  // Page added as a touch event
NexPage page2 = NexPage(2, 0, "page2");  // Page added as a touch event

// End of declaring objects


char buffer[100] = {0};


NexTouch *nex_listen_list[] =
{
  &b1,  // Button added
  &b0,  // Button added
  &b4,  // Button added
  &b21,  // Button added
  &b22,  // Button added
  &b23,  // Button added
  &b24,  // Button added
  &bt0,  // Dual state button added
  &h0,  // Slider added
  &r0,  // Radio checkbox added
  &r1,  // Radio checkbox added
  &r2,  // Radio checkbox added
  &c0,  // Checkbox added
  &j0,  // Progress bar as a button added
  &page0,  // Page added as a touch event
  &page1,  // Page added as a touch event
  &page2,  // Page added as a touch event
  NULL  // String terminated
};


void b1PushCallback(void *ptr)
{
  digitalWrite(13, HIGH);
}


void b1PopCallback(void *ptr)
{
  digitalWrite(13, LOW);
}


void b0PushCallback(void *ptr)
{
  counter = counter - 1;

  Serial.print("n3.val=");
  Serial.print(counter);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void b4PushCallback(void *ptr)
{
  counter = counter + 1;

  Serial.print("n3.val=");
  Serial.print(counter);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void bt0PopCallback(void *ptr)
{
  uint32_t number5 = 0;
  bt0.getValue(&number5);

  if(number5 == 1){
    digitalWrite(13, HIGH);
  }else{
    digitalWrite(13, LOW);
  }
}


void h0PopCallback(void *ptr)
{
  uint32_t number2 = 0;
  h0.getValue(&number2);
 
  if(number2==0){
    h0.getValue(&number2);
  }
  
  Serial.print("n4.val=");
  Serial.print(number2);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}



void r0PushCallback(void *ptr)
{
  Serial.print("n9.val=");
  Serial.print(1);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void r1PushCallback(void *ptr)
{
  Serial.print("n9.val=");
  Serial.print(2);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void r2PushCallback(void *ptr)
{
  Serial.print("n9.val=");
  Serial.print(3);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void c0PushCallback(void *ptr)
{
  uint32_t number3 = 0;
  c0.getValue(&number3);
  Serial.print("n1.val=");
  Serial.print(number3);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void j0PushCallback(void *ptr)
{
  Serial.print("j0.pco=");
  Serial.print(63488);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}


void b21PushCallback(void *ptr)
{
  Serial.print("page 0");
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}



void b22PushCallback(void *ptr)
{
  memset(buffer, 0, sizeof(buffer));
  t5.getText(buffer, sizeof(buffer));

  Serial.print("t23.txt=");
  Serial.print("\"");
  Serial.print(buffer);
  Serial.print("\"");
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}



void b23PushCallback(void *ptr)
{
  memset(buffer, 0, sizeof(buffer));
  t6.getText(buffer, sizeof(buffer));

  Serial.print("t23.txt=");
  Serial.print("\"");
  Serial.print(buffer);
  Serial.print("\"");
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}



void b24PushCallback(void *ptr)
{
  memset(buffer, 0, sizeof(buffer));
  t7.getText(buffer, sizeof(buffer));

  Serial.print("t23.txt=");
  Serial.print("\"");
  Serial.print(buffer);
  Serial.print("\"");
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);
}

void page0PushCallback(void *ptr)
{
  CurrentPage = 0;
}

void page1PushCallback(void *ptr)
{
  CurrentPage = 1;
}


void page2PushCallback(void *ptr)
{
  CurrentPage = 2;
}

void setup() {
 
  Serial.begin(9600);

  b1.attachPush(b1PushCallback);
  b1.attachPop(b1PopCallback);
  b0.attachPush(b0PushCallback);
  b4.attachPush(b4PushCallback);
  b21.attachPush(b21PushCallback);
  b22.attachPush(b22PushCallback);
  b23.attachPush(b23PushCallback);
  b24.attachPush(b24PushCallback);
  bt0.attachPop(bt0PopCallback);
  h0.attachPop(h0PopCallback);
  r0.attachPush(r0PushCallback);
  r1.attachPush(r1PushCallback);
  r2.attachPush(r2PushCallback);
  c0.attachPush(c0PushCallback);
  j0.attachPush(j0PushCallback);
  page0.attachPush(page0PushCallback);
  page1.attachPush(page1PushCallback);
  page2.attachPush(page2PushCallback);


  pinMode(13, OUTPUT);

}

void loop() {

  delay(30);

  variable1++;
  if(variable1 > 240){
    variable1 = 0;
  }

  Serial.print("n0.val=");
  Serial.print(variable1);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);

  Serial.print("np.val=");
  Serial.print(CurrentPage);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);


  if(CurrentPage == 0){
 
    Serial.print("t1.txt=");
    Serial.print("\"");
    Serial.print("Hello!");
    Serial.print("\"");
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
  }

  if(CurrentPage == 1){
    Serial.print("add 2,0,");
    Serial.print(variable1);
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
  }

  if(CurrentPage == 2){
    Serial.print("z0.val=");
    Serial.print(variable1);
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);
 
  }

  nexLoop(nex_listen_list);
  }


can you pleace tell me what is the
Code: [Select]
Serial.print("add 2,0,");
    Serial.print(variable1);
UBUNTU:
"I am what I am, because of who we all are", compassion, kindness and humanity that connect us together by sharing  ourselves with others and caring for those around us.

PerryBebbington

Hello Rafal,
You have help from Seithan, I think he understands the libraries, so his help will be much better than mine.

For this:

Quote
The last one called MCU. This one is what the Arduino send over Serial via USB
Thank you and ++Karma; I have not use this before, I will investigate it.


Quote
For your last question, yes i know C/C++ and i completly understand the Code i Post..
OK, good, I'm glad that's cleared up, thank you.


Quote
I'm French and maybe my English is not very clear for you.
I can't criticise, you certainly know more English than I know French! There is a French forum on this web site, should you prefer to get help from a French speaker.

Good luck with your project.






TheRafal

Thank you Perry for your comment, yes i know for the french User forum, but more mick to have an answers in english!

What do you think about voltage Serial voltage from nextion? It's an 7.0" enhanced RTC.

For Seithan:

The baud is because i use this baud for my personal solution, it send over 60 values at the same time to the screen and want an high refresh rate. It Was set in nextion and work well for data send from arduino to screen. I'll try tomorow the 9600 baud. I'm intrusting because the baud in the tuto video is 115000 and work well, but i'll try.

For the nexLoop, it's a mistake from me during copy paste and clear comments ^^

For np Text, yes it's np and the objectname in nextion too, no Probleme with that. Like i say, when i debug it in nextion with MCU input All values and data work, but not with the screen.

I'll try your code to be sure!

 I can't explain you whats is use for you ask, i just use this sketch to try if it's à Problem of my personal Sketch or my nextion screen broken. That's why i don't change anything appart baud rate.

I let you know as soon as possible.

PerryBebbington


Quote
What do you think about voltage Serial voltage from nextion? It's an 7.0" enhanced RTC.
I'm not clear what you are asking; I have a 7" Enhanced CTP working with a PIC at 5V, another connected to an ESP8266, which runs on 3v3, and a 7" RTP working with a Wemos M0 (I think that's what it is), which is also a 3V3 board. All work without a problem. Does that answer the question? If not, ask a different question!


Seithan

#10
Nov 18, 2019, 12:40 am Last Edit: Nov 18, 2019, 06:34 am by Seithan
Hello Rafal,
You have help from Seithan, I think he understands the libraries, so his help will be much better than mine.
Believe me Perry, I never understood those librarys and I despise them more then you ,
Nextion monitors have the advantage that you can design graphics without writing any code and those librarys come to make our life harder (when they work  :)  )  as they need a special language that no one knows and we can't find reference for that "language" and finally, it is not needed because you can operate them much better with C or whatever is the Arduino language.

@TheRafal if you want to check out that, your Nextion screen will be working and will not be damaged. Try a small project with out the need of hardware set up.

You can find one on my website with both the .ino and .HMI files

They work for sure and they do not need any library
just change the display size and model from the .HMI

https://seithan.com/nextion-projects/send-values-store-them-on-arduino/
UBUNTU:
"I am what I am, because of who we all are", compassion, kindness and humanity that connect us together by sharing  ourselves with others and caring for those around us.

TheRafal

#11
Nov 18, 2019, 07:29 am Last Edit: Nov 18, 2019, 08:51 am by TheRafal
I'm not clear what you are asking; I have a 7" Enhanced CTP working with a PIC at 5V, another connected to an ESP8266, which runs on 3v3, and a 7" RTP working with a Wemos M0 (I think that's what it is), which is also a 3V3 board. All work without a problem. Does that answer the question? If not, ask a different question!


Oh... I asking the voltage you have on the blue wire. I use the screen with the small USB power PCB and i have 5V on the blue wire. When i read your tuto, i've understood your voltage on blue wire is 3V. It's that ?

@Seithan i'll try your project now and let you know.

EDIT: So, i've tested your project, doesn't work on screen but the MCU input in simulator, like others.

I've seen before during my test, if i've a loop that send data to screen without any touch event, if i unplug the blue wire, sending stop. Is it normal ?

EDIT2:...tada !!! I test the arduino on the SAME power supply than screen and not on USB and the touch event now work !!!! Completly crazy !! I think i need to power arduino and nextion with the same power supply, why ? i don't know maybe to avoid noise or something else :/

So thank you all for your help ! Karma ++ for both of you !

PerryBebbington


Quote
Believe me Perry, I never understood those librarys and I despise them more then you
:) I believe you! I guess you are more willing than me to help someone who is trying to use them. I just warn people off them. As far as I know there is only one person on these forums who really understands them but that person has not been answering questions much, leaving people who want to use the libraries with no one to help them. Better not to use them.


Quote
Oh... I asking the voltage you have on the blue wire. I use the screen with the small USB power PCB and i have 5V on the blue wire. When i read your tuto, i've understood your voltage on blue wire is 3V. It's that?
The blue wire - Tx from Nextion - has 3V3 on it when idle, this is the output voltage from the Nextion. If you are seeing 5V then I don't know where that's coming from. I've not had a problem with anything I have driven from the 3V3 on the blue wire from the Nextion; PICs at 5V, various Arduinos at both 3V3 and 5V.


Seithan

Hello TheRafal.
EDIT2:...tada !!! I test the arduino on the SAME power supply than screen and not on USB and the touch event now work !!!! Completly crazy !! I think i need to power arduino and nextion with the same power supply, why ? i don't know maybe to avoid noise or something else :/
Not crazy at all. I thought you already had been using COMMON GND, because the common GND is needed, so the devices have the same reference Voltage for the low Voltage bit (0V). You can search this on google: "common ground on serial communication". So you can have a different power supply, as long as you use common ground. :)

https://itp.nyu.edu/physcomp/lessons/serial-communication/serial-communication-the-basics/

Quote
In order to communicate, the two devices need to agree on a few things:

*the rate at which data is sent and read
*the voltage levels representing a 1 or a 0 bit
*the meaning of those voltage levels; is a high voltage 1 and a low voltage 0, or is the signal inverted so that a low voltage is a 1 and high voltage is 0?

For example, let's say two devices are to exchange data at a rate of 9600 bits per second. First, you would make sure there's an agreed upon high and low voltage supplying each device, then you'd make three connections between the two devices:

*a common ground connection, so both devices have a common reference by which to measure voltage;
*one wire for the sender to send data to the receiver on (transmit line for the sender);
*one wire for the receiver to send date to the sender on (receive line for the sender).

UBUNTU:
"I am what I am, because of who we all are", compassion, kindness and humanity that connect us together by sharing  ourselves with others and caring for those around us.

TheRafal

I know this "things", i've made it whith my GPS and BlueTooth, but i don't know why i forget it for the screen...

Go Up