Itead Nextion need help Programming


I have one nextion 2.8" display that runs with my arduino. I have created a user interface created some dual state buttons and a couple of text boxes. Well my problem is in arduino code. In my code i am using SimpleTimer Library to work with multitasking, and all other functions work well except I can not get the state of dual state button to change. I need some help please. Do you guys have any ideas or best practices to help with my problem.

Welcome to the Forum. Nick Gammon has two posts at the top of this Forum that will help you get the most from all of us here. One thing: if you have a code question, post the code you do have using code tags (explained by Nick), tell us what it is supposed to do (test inputs really help), and tell us what the output should be for a give set of inputs. This will help us help you.

Thanks for your advice and reply @econjack.
I am verry big noob vhen it gets to programming, but I have managed to put this code together, it is not yet finished i still havo implement some other functions.
Ok so here it goes:
I have a Nextion TFT touch display with custom UI, that I have created, display is connected to Arduino Uno via serial connection:

On the picture as you see I have a dual state ON - OFF button. And in the code is a nexLoop(nex_listen_list); function that is inside the timer and checks for touch event every 500ms. So my problem is when i have only nexLoop(nex_listen_list); function inside the void timer() function, the dual state button works fine and does what it is programmed to do. For now i only change text in a text field on a display. But when I call other functions inside the void timer(); the button stops working.

void setup() {
  // initialize serial communication at 9600 bits per second:
  zagon.attachPop(zagonPopCallback, &zagon);
  dimnikar.attachPop(dimnikarPopCallBack, &dimnikar);
  pinMode(izhObtPumpa, OUTPUT);
  pinMode(izhVklPeciPeleti, OUTPUT);
  pinMode(izhBojlerPumpa, OUTPUT);
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);
  digitalWrite(izhObtPumpa, LOW);
  digitalWrite(izhVklPeciPeleti, LOW);
  digitalWrite(izhBojlerPumpa, LOW);
  digitalWrite(ledBojlerOgrevanje, LOW);
  digitalWrite(ledSobniTerm, LOW);
  //zagon timerja - če ne dela, prestavi v loop zanko
  //timer za zagon peči, ki mora laufat vsaj 15min
  timeOut15min = timer.setInterval(600000, TimeOut15);
  //timer za popolno zaklučitev delovanja peči
  timeOut5min = timer.setInterval(600000, TimeOut5);

  //timer za sobni termostat
  timeOutSobniTermostat = timer.setInterval(120000, TimeOutSobniTermostat);
  //zagon intervalnih timerjev
  timer.setInterval(5000, Temperatura);
  timer.setInterval(500, Timer500);


// the loop routine runs over and over again forever:
void loop() {;
  //digitalWrite(ledBojlerOgrevanje, HIGH);


void Timer500 ()
  ObtocnaCrpalka ();
  VklopPeletiPec ();
  BojlerCrpalka ();
  Izhodi ();

regulator_ver0_4.ino (10.9 KB)