Activity › Forums › Questions & Troubleshooting › Software & Firmware › Communication between Maxi Automation and Nextion Display
-
Communication between Maxi Automation and Nextion Display
-
Hello So far I worked with an Arduino Mega and a Nextion Enhanced display.Communication is via serial2 at 112500 baud without any issues. If I connect
RX2 and TX2 of Nextion display to TXD2(X2.22) and RXD2(X2.23) and power up the Nextion display via external 5V with common ground I am not able to communicate anymore. The Arduino IDE was used and the same program was flashed to the Maxi Automation. What can be the reason for that?
Kind regards
Marcel
-
Communication is working again. Issue was related with function nexInit(); out of Itead Library from Nextion. Somehow synchronization between MCU and Nextion display failed. A delay(100); was necessary after nexInit(); in case of 115200 baud. -
Good day, I recently started work on a project using the Controllino Maxi Automation and a Nextion NX8048K070-011C. So far I am able to use the Arduino IDE Serial Monitor to see the input from a sensor that I have connected to it, however when I try to connect the Nextion display and try to output the numbers that I have being incremented to the Nextion display I m not getting anything going from the Controllino to the Nextion display. I have used both X1 and X2 and it didn’t work the code I tried is shown below:
Code:
#include/* Usage of CONTROLLINO library allows you to use CONTROLLINO_xx aliases in your sketch. */ int sensorState = 0;
int bagCount = 0;
int runningBagCount = 0;
int onState = 0;
int offState = 1;
bool flag = true;void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(CONTROLLINO_DI0, INPUT);}
void loop() {
// put your main code here, to run repeatedly:
sensorState = digitalRead(CONTROLLINO_DI0);if (sensorState == onState)
{
if (sensorState == offState)
{
flag = true;
}else if (sensorState == onState)
{
flag = false;
if (sensorState == onState && flag == false)
{
bagCount = bagCount + 1;
runningBagCount = runningBagCount + 1;
Serial.print(“Number of Bags in Stack: “);Serial.print(bagCount);Serial.print(“n”);
Serial.print(“n0.val=”); // This is sent to the nextion display to set what object name (before the dot) and what atribute (after the dot) are you going to change.
Serial.print(runningBagCount); // This is the value you want to send to that object and atribute mention before.
Serial.write(0xff); // We always have to send this three lines after each command sent to the nextion display.
Serial.write(0xff);
Serial.write(0xff);
Serial.print(“Total Number of Bags: “);Serial.print(runningBagCount);Serial.print(“n”);
if (bagCount == 250)
bagCount = 0;
while(sensorState == onState)
{
sensorState = digitalRead(CONTROLLINO_DI0);
}
flag = true;
}
}
}//Serial.print(sensorState);
}
The whole idea is that an inductive sensor will sense something, when it senses something it will increment a counter. There are two counters, a running count and a count that could be set. What I need is that every time the counter increments, this value should be pushed to a field in the nextion HMI. I look forward to your reply
Log in to reply.