2

I have an arduino and a nextion basic display connected to each other. they both send and receive data from each other. when i push a button on the display, the nextion display sends a data to arduino. and this works perfectly. the code that is working perfectly is this:

#include <Nextion.h>

NexDSButton bt0 = NexDSButton(0, 10, "bt0");
NexTouch *nex_Listen_List[] = {&bt0, NULL};

void bt0PopCallback(void *ptr)
{
 kayityazdir();
}

void setup() 
{
 nexInit();
 pinMode(22, OUTPUT);
 digitalWrite(22, 0);
 bt0.attachPop(bt0PopCallback);
}

void loop() 
{
 nexLoop(nex_Listen_List);
 digitalWrite(22, 0);
}
void kayityazdir()
{
 digitalWrite(22, 1);
 delay(2000);
}

But when i add the following parts, the display strangely works meaningless or doesn't work at all.

#include <Nextion.h>

NexDSButton bt0 = NexDSButton(0, 10, "bt0");
NexTouch *nex_Listen_List[] = {&bt0, NULL};

NexNumber n0 = NexNumber(0, 6, "n0");  // the added parts
NexNumber n1 = NexNumber(0, 7, "n1");  //  the added parts

void bt0PopCallback(void *ptr)
{
  kayityazdir();
}

void setup() 
{
  nexInit();
  pinMode(22, OUTPUT);
  digitalWrite(22, 0);
  bt0.attachPop(bt0PopCallback);
}

void loop() 
{
  n0.setValue(100);  //  the added parts
  n1.setValue(200);  //  the added parts
  nexLoop(nex_Listen_List);
  digitalWrite(22, 0);
}
void kayityazdir()
{
  digitalWrite(22, 1);
  delay(2000);
}

Is there a solution for this? How can I make the second code work properly?

  • Well, there is a Turkish video it will solve your problem easly. TURKISH: Bu video serisini izlersen bayağı yardımcı olacaktır. https://youtu.be/TwttdNJ7pkE?t=234 – mehmet Sep 04 '20 at 20:54

0 Answers0