I'm just here for advice this is not really a bug in Nextion X2 library. What I experience is that when I add some additional logic to the loop-method it doesn't trigger my btnStepUp method any more. When I disable the sensor check it does work. I presume it's because the Nextion display already sent the data but the arduino is not listening because it's busy checking IO ports. Do you have experience on how to handle this?
#include "NextionX2.h"
#include "SoftwareSerial.h"
#include <ezButton.h>
SoftwareSerial SerialNextion(PA10, PA9);
NextionComPort nextion;
#define topPin PB10
NextionComponent btUp(nextion, 0, 8);
ezButton topSensor(topPin);
void setup()
{
nextion.begin(SerialNextion);
pinMode(LED_BUILTIN, OUTPUT);
btUp.touch(btnStepUp);
}
bool initDone = false;
void loop()
{
nextion.update();
/// If this is enabled nextion touch trigger doesn't work anymore
// topSensor.loop();
// if (dir == CCW && topSensor.getState() == LOW)
// {
// topPosition = stepper.currentPosition();
// dir = CW;
// }
// I also tried to add another update() at the end of the loop but no difference
// nextion.update();
}
void btnStepUp()
{
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}
Hi,
I'm just here for advice this is not really a bug in Nextion X2 library. What I experience is that when I add some additional logic to the loop-method it doesn't trigger my
btnStepUp
method any more. When I disable the sensor check it does work. I presume it's because the Nextion display already sent the data but the arduino is not listening because it's busy checking IO ports. Do you have experience on how to handle this?