Start a new topic

ITEADLIB_Nextion Change nexSerial

Hi,

I am trying to use Serial2 on the Particle Photon to connect with my Nextion display. I am successful with Serial1 using the following sample code:

 

#include "ITEADLIB_Nextion.h"

USARTSerial& nexSerial = Serial1;

NexNumber n0 = NexNumber(0, 8, "n0");
NexNumber n1 = NexNumber(0, 9, "n1");

int num = 0;

void setup() {

  nexInit();
}

void loop() {

delay(100);
  n0.setValue(num);
  n1.setValue(3*num);
  num++;
}

 But when I try USARTSerial& nexSerial = Serial2; I get build didn't produce binary Error: Command failed.


Looking through Itead's tutorial for Arduino, it seems that they have #define nexSerial Serial2 in Nex.Config.h. Mine has extern USARTSerial& nexSerial; instead. I tried their method and removed the extern USARTSerial lines from my .ino and NexConfig.h. Still got the same error.


image


Any help will be appreciated.


Many thanks,

Ben

Login or Signup to post a comment