Nextion make Arduino work very slow

Hi! I have problem about Arduino Uno with Nextion Panel. Program is below 500micro second delay and it gives 1khz output. It works fine. But nextion is disabled.

If i remove // from the beginging of these lines. So that means nextion is enabled. Then output is like 1hz. How can i solve it ?
//bt0.getValue(&butondurum);

#include “Nextion.h”
#include <SoftwareSerial.h>
// Master RX, TX, connect to Nextion TX, RX
SoftwareSerial HMISerial(10, 11);

NexDSButton bt0 = NexDSButton(0, 1, “bt0”);
NexText t0 = NexText(0, 2, “t0”);
NexText t1 = NexText(0, 7, “t1”);
NexNumber n0 = NexNumber (0,3, “n0”);

uint32_t butondurum = 0;
uint32_t hizdurum = 0;
uint32_t pulse_cikisi = 0;
uint32_t hiz = 0;
unsigned long eskiZaman=0;
unsigned long yeniZaman=0;
const int led = 3;
boolean durum = HIGH;
int aralik = 500;

void setup(void)
{
Serial.begin(100);
dbSerialPrintln(“setup begin”);
nexInit();
dbSerialPrintln(“setup done”);

pinMode(13, OUTPUT);
pinMode(5, OUTPUT);
pinMode(led, OUTPUT);
}

void loop(void)
{

//bt0.getValue(&butondurum);

if (butondurum == 1)
{

digitalWrite(13, HIGH);
digitalWrite(5, HIGH);

}
else if (butondurum == 0)
{

digitalWrite(13, LOW);
digitalWrite(5, LOW);

}

yeniZaman = micros();
if (yeniZaman - eskiZaman >= aralik)
{
eskiZaman = yeniZaman;
if (durum == HIGH)
durum = LOW;
else if ( durum == LOW)
durum = HIGH;

digitalWrite(led , durum);

}

}

Hello
Welcome to the Arduino fora.
Before you do anything else please read General guidance
And
How to use this forum
Especially item #7 on posting code.

The Nextion libraries are full of bugs and that might be the source of your problem. If you read 'using Nextion displays with Arduino' you can either use the methods set out there or, if you prefer, follow the link to the improved Nextion libraries created by Ray Livingston. Ray has removed many of the bugs.

PerryBebbington:
Hello
Welcome to the Arduino fora.
Before you do anything else please read General guidance
And
How to use this forum
Especially item #7 on posting code.

The Nextion libraries are full of bugs and that might be the source of your problem. If you read 'using Nextion displays with Arduino' you can either use the methods set out there or, if you prefer, follow the link to the improved Nextion libraries created by Ray Livingston. Ray has removed many of the bugs.

Thanx for help. I will also follow the rules. Sorry about that.
By the way. You forgot to share link but i found it in forum. But it did not help. That library was suitable for Arduino Mega. I switch it to Mega and pulse output must be 1khz and i got around 3hz. 3 times faster than Uno (because of library) but it is nothing. What can i do ? Or is there any different touch display or without touch display but not making any huge delays on program. ?

I can only offer that you try the methods as set out in my tutorial, but you will have to work through it and understand how it works, it's quite different to any library. It does however work and does not put much demand on the processor.

If your code is slow then I wonder if you have any delay(); in it? If you do you need to get rid of the delays.

If you share your code (don't forget the code tags) I will have a quick look, but I can't promise anything.