Unofficial Nextion/TJC User Forum

recvRetCommandFinished err?

Hello
im total new in nextions display.
I try now a sample like that

that is with temp sensor.

i have had configure the Nextion Display with Nextion editor.
The display talk with an arduino Mega. Thats the reason why i not changed anything in any nextion-files.

I configure the buttons in the display with any objektnames.
If i push any button then i get this message in my serial-monitor

[1638:0,2,hBt]
[1650:0,6,dbBt]
[1650:0,6,dbBt]

i not understand what are the first numbers like 1638 or 1650.

normaly i think he have to jumb now in this
void dbBtPopCallback(void *ptr) {

but he do nothing.

I have also run the display with 5V power supply (not the lowest mA, 5V from arduino mega)

best regards

Achim

edit: this message
recvRetCommandFinished err
recvRetCommandFinished err
comes on start the arduino and display !

sometimes i get also an
recvRetCommandFinished ok

but i don’t know why

my display
NX4832K035

thats my arduino code… !! I check objectnames, id and page-number already

/*

  • Rui Santos
  • Complete Project Details
    */

#include “Nextion.h”

#include “DHT.h”
#define DHTPIN 12 // what digital pin we’re connected to

// Uncomment whatever type you’re using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Initialize DHT sensor.
DHT dht(DHTPIN, DHTTYPE);

// LED pins
const int led1 = 8;
const int led2 = 9;

// Declare your Nextion objects - Example (page id = 0, component id = 1, component name = “b0”)
NexText tempFb = NexText(0, 17, “tempFb”);
NexButton dbBt = NexButton(0, 6, “dbBt”);
NexButton hBt = NexButton(0, 2, “hBt”);
NexText humFb = NexText(0, 18, “humFb”);

// Register a button object to the touch event list.
NexTouch *nex_listen_list[] = {
&tempFb,
&dbBt,
&hBt,
&humFb,
NULL
};

/*

  • Button bUpdate component pop callback function.
  • When the UPDATE button is released, the temperature and humidity readings are updated.
    */
    void dbBtPopCallback(void *ptr) {
    Serial.print("check 11111 ");

// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
//float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) ) {
return;
}
// Serial.print(“Temperature :”);
// Serial.println(temperatureCTemp);
Serial.print(F("% Temperature dht: "));
Serial.println(t);

static char temperatureCTemp[6];
dtostrf(t, 6, 2, temperatureCTemp);
tempFb.setText(temperatureCTemp);
Serial.print(F("% Temperature dh2t: "));
Serial.println(temperatureCTemp);

}

void hBtPopCallback(void *ptr) {
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
//float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) ) {
return;
}
// Update temperature in Celsius
static char temperatureCTemp[6];
dtostrf(t, 6, 2, temperatureCTemp);
tempFb.setText(temperatureCTemp);

// Update humidity percentage text and progress bar
char hTemp[10] = {0};
utoa(int(h), hTemp, 10);
humFb.setText(hTemp);
//humFb.setValue(int(h));

}

/*
&tempFb,
&dbBt,
&hBt,
&humFb,
*/
void setup(void) {
dht.begin();
Serial.begin(9600);

// You might need to change NexConfig.h file in your ITEADLIB_Arduino_Nextion folder
// Set the baudrate which is for debug and communicate with Nextion screen
nexInit();

// Register the pop event callback function of the components
dbBt.attachPop(dbBtPopCallback, &dbBt);
hBt.attachPop(hBtPopCallback, &hBt);
// h0.attachPop(h0PopCallback);
// bUpdate.attachPop(bUpdatePopCallback, &bUpdate);

// Set LEDs as outputs
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}

void loop(void) {
/*

  • When a pop or push event occured every time,
  • the corresponding component[right page id and component id] in touch event list will be asked.
    */
    nexLoop(nex_listen_list);

}

ok,
i know now what’s the problem.

I have some buttons on every page ( i have 5 pages) for call any page.
If i push one of that page buttons and i would like get on the second page any date from any sensor then he get the page but not more

if i use the same button and change the event in nextion-editor ( not call more any page)… then my programm works fine… i get the temperature and he write the date in the right field…

The problem have to do with “call any sub-page”

what i can do?


This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).