Start a new topic

issue with getValue cmd


so thanks to Patrick Martin, I finally made my Uno work with Nextion, I rewrited CompNumber code and it doesn't work. I checked it many times and compared with original code, but I could not find the problem. 

It gets the number from display, but only for first time. When I press the button 2nd time, it prints 0 in serial monitor. (Screenshot attached) +There are many ??? symbols, is it ok or I made a mistake anywhere? 

Please, note that I am beginner and I don't understand it that much as you. :)

Here is my code:  

#include "Nextion.h"
uint32_t number;
void b6PopCallback(void *ptr);
NexNumber Rn1 = NexNumber(1, 2, "Rn1");
NexButton b6 = NexButton(1, 22, "b6");
char buffer[100] = {0};

NexTouch *nex_listen_list[] = 

void b6PopCallback(void *ptr)
    uint32_t number;
void setup() {
  // put your setup code here, to run once:
    b6.attachPop(b6PopCallback, &b6);
    dbSerialPrintln("setup done");

void loop() {
  // put your main code here, to run repeatedly:

I am attaching 2 files, HMI (i am making thermometer and LED strip control for my PC build) and screenshot of serial monitor when I multiple times press button "SAVE" on page 1. 

This code is made only for one number - Rn1 on page 1, you can edit this number by pressing "E" button. 

Please, can you help me with this? 

Jakub Lepík

1 Comment

??? is expected.

all commands terminate with 0xFF 0xFF 0xFF

in iso-8859-01 this would show as ÿÿÿ

Nextion Instruction Set - Return Data.

If Uno is working serial with Nextion

  - NexConfig.h

    dbSerial not enabled

    nexSerial Serial

Then you shouldn't be seeing in Serial Monitor.

I believe on CAN piggyback a Serial on the UNO

 - I would not.

Instead of having debug values goto Serial Monitor

 - it is also easy to add temp t1 and n1 to project

such that when you want to know value received 

  (ie n0.getValue(&number); )

then send it to the other number

  (ie n1.setValue(number); )

In this way you can visually debug

  when satisfied remove n1 and debugging statements.

Login or Signup to post a comment