Coder Social home page Coder Social logo

iteadlib_arduino_nextion's Introduction

@mainpage Home Page

Nextion


Introduction

Nextion Arduino library provides an easy-to-use way to manipulate Nextion serial displays. Users can use the libarry freely, either in commerical projects or open-source prjects, without any additional condiitons.

For more information about the Nextion display project, please visit the wiki。
The wiki provdies all the necessary technical documnets, quick start guide, tutorials, demos, as well as some useful resources.

To get your Nextion display, please visit iMall.

To discuss the project? Request new features? Report a BUG? please visit the Forums

Download Source Code

Latest version is unstable and a mass of change may be applied in a short time without any notification for users. Commonly, it is for developers of this library.

Release version is recommanded for you, unless you are one of developers of this library.

Release notes is at https://github.com/itead/ITEADLIB_Arduino_Nextion/blob/master/release_notes.md.

Latest(unstable)

Latest source code(master branch) can be downloaded: https://github.com/itead/ITEADLIB_Arduino_Nextion/archive/master.zip.

You can also clone it via git:

git clone https://github.com/itead/ITEADLIB_Arduino_Nextion

Releases(stable)

All releases can be available from: https://github.com/itead/ITEADLIB_Arduino_Nextion/releases.

Documentation

Offline Documentation's entry doc/Documentation/index.html shiped with source code can be open in your browser such as Chrome, Firefox or any one you like.

Suppported Mainboards

All boards, which has one or more hardware serial, can be supported.

For example:

  • Iteaduino MEGA2560
  • Iteaduino UNO
  • Arduino MEGA2560
  • Arduino UNO

Configuration

In configuration file NexConfig.h, you can find two macros below:

  • dbSerial: Debug Serial (baudrate:9600), needed by beginners for debug your nextion applications or sketches. If your complete your work, it will be a wise choice to disable Debug Serial.

  • nexSerial: Nextion Serial, the bridge of Nextion and your mainboard.

Note: the default configuration is for MEGA2560.

Redirect dbSerial and nexSerial

If you want to change the default serial to debug or communicate with Nextion , you need to modify the line in configuration file:

#define dbSerial Serial    ---> #define dbSerial Serialxxx
#define nexSerial Serial2  ---> #define nexSeria Serialxxx

Disable Debug Serial

If you want to disable the debug information,you need to modify the line in configuration file:

#define DEBUG_SERIAL_ENABLE ---> //#define DEBUG_SERIAL_ENABLE

UNO-like Mainboards

If your board has only one hardware serial, such as UNO, you should disable dbSerial and redirect nexSerial to Serial(Refer to section:Serial configuration).

Useful Links

http://blog.iteadstudio.com/nextion-tutorial-based-on-nextion-arduino-library/

License


The MIT License (MIT) 

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

iteadlib_arduino_nextion's People

Contributors

hedda avatar huangxianming avatar hxming123456 avatar yzjczp avatar zarya avatar zhangabc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iteadlib_arduino_nextion's Issues

Can we read and write to the sd card?

there is a sd card slot at the back of the screen for updating the GUI. However is it possible to get access (read/write) to the card for user data with the serial connection? thank you

Use of foul language

Can I ask please why you find it necessary to use foul language in the documentation for this library? (see file "index.html" in directory "html")

I've been told that it is a valid software licence. Most certainly it is not a professional one.

Could it be removed please?

read data from serial

Hi,
how I can to read with arduino interface, data from serial input (RX) and put it on display ?
for example, a device send to Nextion numbers from 1 to 9 like 123456789, and I need to see it on diplay.
please a sample code..

Arduino Due and ProgressBar does not work on J0 because of math.h

Hello,

There seems to be a conflict between the math.h and the Nextion Lib.
J0 and J1 are allready in use. I am not sure if this problem also exists for other devices.

CompProgressBar:22: error: 'NexProgressBar j0' redeclared as different kind of symbol
In file included from C:\Users\xxx\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.4\cores\arduino/Arduino.h:26:0,
from C:\Users\xxx\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion/Nextion.h:20,
from CompProgressBar.ino:20:
c:\users\xxx\appdata\roaming\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\math.h:471:15: error: previous declaration of 'double j0(double)'
extern double j0 PARAMS((double));
^
CompProgressBar.ino: In function 'void buttonUpPopCallback(void
)':
CompProgressBar:38: error: request for member 'getValue' in 'j0', which is of non-class type 'double(double)'
CompProgressBar:46: error: request for member 'setValue' in 'j0', which is of non-class type 'double(double)'
CompProgressBar.ino: In function 'void buttonDownPopCallback(void_)':
CompProgressBar:54: error: request for member 'getValue' in 'j0', which is of non-class type 'double(double)'
CompProgressBar:61: error: request for member 'setValue' in 'j0', which is of non-class type 'double(double)'
Multiple libraries were found for "Nextion.h"
Used: C:\Users\xxx\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion
Not used: C:\Users\xxx\Documents\Arduino\libraries\nextion-bborncr
'NexProgressBar j0' redeclared as different kind of symbol

Unable to update Nextion display

Hi,
I am uploading example code to my arduino UNO using only nexSerial. I am unable to see any changes on the display. It always shows me the default screen by ITLEADS STUDIO.

Am I missing anything? or doing anything wrong

Inconsistent licensing

Hello,

I wonder what is the license of this library.

There is (at least) 3 conflicting informations about license.

https://github.com/itead/ITEADLIB_Arduino_Nextion/blob/master/license.md
states is MIT licensed

<pre class="fragment">DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

states is WTFPL licenses (#49)

* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.

states is GPL v2

Kind regards

PS : see also #48 (comment)

Ajust LIB ESP8266 With SDCard

Hello guys,

Nextion has two libs to upload.

NextionUpload that uses Serial or Serial Software with SD
EspNextionUpload that uses softwareserial and SPIFFS

For example in my project using ESP8266 with SD Card and HardwareSerial I had to make some adjustments.

ESPNextionUploadHWSerialSD.zip

COM Port Monitor

I want to make the monitor com port. How do I display the Nextion data from com port? Can I do that with just Nextion or need a microcontroller?

ESP32 / Nextion connection error

Hi,
I have some problem to communicate between my ESP32 and my nextion screen.
I try with a default example CompButton_v0_32 and when I call nexinit() I have a false error code recvRetCommandFinished err

I investigate and modify NexHardware.cpp to show the result from the display.
In function bool recvRetCommandFinished(uint32_t timeout), I just add 1 line :

    for (int i = 0; i < 4; i++) Serial.println(temp[i], HEX);

The result, in the Arduino serial monitor was very strange for me and corresponding to nothing:
`recvRetCommandFinished err
FE
FF
FF
62

0
recvRetCommandFinished err
70
61
67
65

0`

Could you help me ?
Regards
[email protected]

PS : I work on an EP32 (v1.0.1), ITEADLIB Arduino Nextion library get from github (v0.9.0)

getText does not work on text box

I was working on interfacing a Nextion Display with Arduino Mega.

The GUI has 3 Pages. The first page is used to display data, while the other two are used to take inputs and set some parameters.

After the user inputs data into the text box, I tried to get the value of the text box with the getText() method which is a member function of the NexText calss.

The method works fine if the text box is on the first page, but fails if it is on the second or the third page.

When getting the values the screen in not in the foreground on the Nextion Display

Lost events from display

Please explain purpose of nexSerial.read() in sendCommand? I think it just drops cache of received data, therefore data is lost. Problem on Nano V3 328P. Thanks!

void sendCommand(const char* cmd)
{
while (nexSerial.available())
{
nexSerial.read();
}

nexSerial.print(cmd);
nexSerial.write(0xFF);
nexSerial.write(0xFF);
nexSerial.write(0xFF);

}

Comparison of alternatives Arduino / Nextion libraries

Hello,

I noticed that several libraries for Arduino and Nextion smart display exist.

What are pros and cons of each libraries?

Pinging @shennongmin @bborncr @DanNixon

After enumerating differences, a paragraph about this could probably be added to https://github.com/itead/ITEADLIB_Arduino_Nextion/blob/master/readme.md

Kind regards

Dual State Issue

Hi,

I'm trying your library (release 7.0), when i added it to Arduino IDE, i can't view CompDSButton example and others.
I copied your example from Github, and when it's compiled i get
//
ArduinoMEGA_Nextion:68: error: 'bt0' was not declared in this scope
bt0.getValue(&dual_state);
^
D:\Arduino\ArduinoMEGA_Nextion\ArduinoMEGA_Nextion.ino: In function 'void setup()':
ArduinoMEGA_IR_Reles_LED_Nextion:112: error: 'bt0' was not declared in this scope
bt0.attachPop(bt0PopCallback, &bt0);
^
exit status 1
'NexDSButton' does not name a type ArduinoMEGA_Nextion:68: error: 'bt0' was not declared in this scope
bt0.getValue(&dual_state);
^
D:\Arduino\ArduinoMEGA_Nextion\ArduinoMEGA_Nextion.ino: In function 'void setup()':
ArduinoMEGA_IR_Reles_LED_Nextion:112: error: 'bt0' was not declared in this scope
bt0.attachPop(bt0PopCallback, &bt0);
^
exit status 1
'NexDSButton' does not name a type
/
/
This with release v0.7.0
And in this release v0.7.0 doesn't show CompDualStateButton Example

And if i download zip from Github repository (ITEADLIB_Arduino_Nextion-master.zip), CompDSButton seems that are in libraries, but in Arduino IDE only shows examples : CompGPIO, CompRTC and Upload
With "master" release

It's the DS Button working?
Or how i can do to fix it?

NexVariable::getValue returns uint32_t instead of bool

In NexVariable.h getValue command is marked as:
/**
* Get val attribute of component
* @param number - buffer storing data retur
* @return the length of the data
*/
uint32_t getValue(uint32_t *number);

This functions returns value from "recvRetNumber(number);" which is placed in NexHardware.h as:

bool recvRetNumber(uint32_t *number, uint32_t timeout = 100);

I think "uint32_t getValue(uint32_t *number);" should change to "bool getValue(uint32_t *number);" in NexVariable.h and NexVariable.cpp

Thank you

I can not compile

I downloaded the latest version: git clone https://github.com/itead/ITEADLIB_Arduino_Nextion and I copied it on the path C: \Program Files\Arduino\libraries, I then tried to create a project in the Arduino Ide and added #include "Nextion.h". but the project does not compile.

error:

fatal error: Nextion.h: No such file or directory #include "Nextion.h"

What am I doing wrong?

If you add a library through IDE menu, there are many #include and another error appears:

In file included from C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.h:18:0,

             from C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:15:

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp: In function 'bool recvRetNumber(uint32_t*, uint32_t)':

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

#define nexSerial Serial2

               ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:55:5: note: in expansion of macro 'nexSerial'

 nexSerial.setTimeout(timeout);

 ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:67:31: warning: left shift count >= width of type [enabled by default]

     *number = (temp[4] << 24) | (temp[3] << 16) | (temp[2] << 8) | (temp[1]);

                           ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:67:49: warning: left shift count >= width of type [enabled by default]

     *number = (temp[4] << 24) | (temp[3] << 16) | (temp[2] << 8) | (temp[1]);

                                             ^

In file included from C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.h:18:0,

             from C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:15:

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp: In function 'uint16_t recvRetString(char*, uint16_t, uint32_t)':

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

#define nexSerial Serial2

               ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:114:16: note: in expansion of macro 'nexSerial'

     while (nexSerial.available())

            ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp: In function 'void sendCommand(const char*)':

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

#define nexSerial Serial2

               ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:166:12: note: in expansion of macro 'nexSerial'

 while (nexSerial.available())

        ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

#define nexSerial Serial2

               ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:171:5: note: in expansion of macro 'nexSerial'

 nexSerial.print(cmd);

 ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp: In function 'bool recvRetCommandFinished(uint32_t)':

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

#define nexSerial Serial2

               ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:192:5: note: in expansion of macro 'nexSerial'

 nexSerial.setTimeout(timeout);

 ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp: In function 'bool nexInit()':

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

#define nexSerial Serial2

               ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:226:5: note: in expansion of macro 'nexSerial'

 nexSerial.begin(9600);

 ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp: In function 'void nexLoop(NexTouch**)':

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexConfig.h:37:19: error: 'Serial2' was not declared in this scope

#define nexSerial Serial2

               ^

C:\Program Files\Arduino\libraries\ITEADLIB_Arduino_Nextion\NexHardware.cpp:242:12: note: in expansion of macro 'nexSerial'

 while (nexSerial.available() > 0)

        ^

exit status 1
Error compiling for board Arduino Nano.

NexHardware.cpp Major Code Design Flaw Causing Missed User Input!!

Hello,
If you implement this code in a device where you are using a microcontroller to refresh the Nextion screen with new data periodically, as well as allow user touch input, user input ends up often being ignored because of this way this code is written, especially when the microcontroller is busy doing something else when the input is sent from the Nextion to the microcontroller. As it stands, you have to call nexLoop before sending any command to the Nextion to make sure the serial buffer isn't cleared out from the code below, which in itself could create all sorts of user interaction timing issue. Also, if you were to eliminate clearing the serial buffer and send a command without calling nexLoop before sending the command, each of the three methods below that also read from the Serial buffer will also cause a problem since there will be user touch input queued in the serial buffer, not the response!
bool recvRetNumber(uint32_t *number, uint32_t timeout)
uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout)
bool recvRetCommandFinished(uint32_t timeout)

Take a look at the beginning of the below method. Why would you clear out the serial buffer from queued commands?
void sendCommand(const char* cmd)
{
while (nexSerial.available())
{
nexSerial.read();
}

There should be only one method doing nexSerial.read() in NexHardware.cpp. It should read the serial buffer stack, and based on the byte code header sent from the Nextion, call the appropriate method based on the data received from the Nextion after receiving a full command.

Please contact me if you need assistance as I'm already starting a full rewrite.

Clearly the only issue with a proper implementation is that you may want to eliminate confirmation of commands to the Nextion as there's no way to really implement this without queuing the user input. Leave it up to the use to re-read the value sent to the Nextion to validate that it is set properly.

Tags:
Nextion Arduino Library Intermittently Missing Button Presses and User Input

Continuous Integration / Ensure this library can be compiled

Hello,

You should ensure that this library can be compiled.

Adding this .travis.yml (or something close to this) is necessary

language: python
python:
    - "2.7"

# Cache PlatformIO packages using Travis CI container-based infrastructure
sudo: false
cache:
    directories:
        - "~/.platformio"

env:
    - PLATFORMIO_CI_SRC=examples/CompButton
    - PLATFORMIO_CI_SRC=examples/CompCrop
    #- PLATFORMIO_CI_SRC=...

install:
    - pip install -U platformio

    # Libraries from PlatformIO Library Registry:
    #- platformio lib -g install ...

script:
    #- platformio ci --board=uno --board=teensy31 --board=due --lib="."
    - platformio ci --board=uno --lib="."

See
http://docs.platformio.org/en/latest/ci/travis.html

Adding unit tests could also help to improve quality (but that could be done in a next iteration)

Kind regards

Functions for "set" uses only getObjName() for object identification

Functions for "set" (SetText, SetValue, ...) uses only getObjName() for object identification, doesn't matter which pid is set:
e.g. i have 2 pages, p0 and p1
on both pages is text element t1
in arduino code is defined:
NexText txt0 = NexText(0, 1, "t1");
whet i use function txt1.setText(buffer), this function change txt value of component t1 on actual page
so when actual page in p1 then t1.txt on this page is changed
but txt0 was defined for page 0, not for page 1

Compile Error on Arduino

Running Arduino 1.0.5

Added Nextion Library and have consistent compile errors all related to NextionButton.cpp. All similar to below.

/libraries/Nextion/NexButton.cpp: In member function 'uint16_t NexButton::getText(char*, uint16_t)':
/libraries/Nextion/NexButton.cpp:29: error: 'class String' has no member named 'c_str'

utoa not included in standard C/C++ lib

We're working on an Intel Edison which uses GNU libc/c++ and we've been trying to compile our nextion code but it doesn't work because utoa is not included in the base C/C++ lib. The only workaround I can currently think of is to modify the library to include utoa. Do you have any other suggestions?

Examples are not working with NodeMCU v0.9

I tried many of the examples with both an Arduino UNO and a NodeMCU v0.9 (ESP8266) and all of them worked in case of the UNO and none of them in case of the NodeMCU.
I connected the Nextion's RX to NodeMCU's D10 pin and Nextion's TX to NodeMCU's D9 pin. Also, I disabled Serial debugging and set #define nexSerial Serial
I found no relevant information on the Internet to solve this issue.

Any help would be appreciated!

nexLoop

If one removes upload.cpp and upload.h from the library after compiling lot of space in ram(local variables)is freed.
what could be the reason.
if one keeps those files you hardly get 40 to 80 bytes for local variables(depending upon your program).
With the same program and with out these files after compilation you get allmost 1000 bytes free.
so one can easily use UNO.

More precise designation

In the Nextion editor you can create objects with same name on different pages. The library use the following code to identify the object:

String cmd = String("get ");
cmd += getObjName();

This is not enough because more object can be with same name.
It is better to use this:

String cmd = String("get ");
cmd += "page";
cmd += getObjPid();
cmd += ".";
cmd += getObjName();

BR,
Kosza

getValue doesnt work

When using the getvalue() method to get a value from a slider, i get the serial output.
get h0.val���recvRetNumber err
source code used
uint32_t number = 0;
char temp[10] = {0};
h0.getValue(&number);
utoa(number, temp, 10);

Change in Serial Implementation

Any chance for add newline ending on each command on nextion hardware firmware and Arduino firmware

it would be more reliable using
nexSerial.readBytesUntil('\r\n',(char *)temp,10)
instead of
if (sizeof(temp) != nexSerial.readBytes((char *)temp, sizeof(temp)))

three 0xFF 0xFF 0xFF bytes implementation isnt reliable
I would suggest to use '\r\n'

Although many features are there in the library but they are unstable and its really too hard to use for any big project.

NexScreen

I have created some missing control function for display.

/**
* Set the brightness of the display.
*
* @param buffer - number (0 - 100).
*/
bool setBrightness(byte buffer);
/**
* Set Nextion sleep mode.
*/
bool Sleep();
/**
* Set Nextion awake mode.
*/
bool Wakeup();
/**
* Set Auto Wake on Touch.
*
* @param buffer - number, 0 (do not wake), 1 (wake on touch), default 0.
*/
bool setAutoWakeup(byte buffer);
/**
* Set Sleep on No Touch.
*
* @param buffer - number of second, 3 - 65535, default 0 (means no timeout)
*/
bool setScreenTouchTimeout(int buffer);

Arduino_Nextion-Screen.zip

NexNumber setValue, getValue not working correctly

MCU: Arduino ATMEGA 2560
Editor: V0.43
Library: V0.9.0

See attached test case: setValue and getValue do not work correctly for values bigger than 32767 on 8 bit systems.

To make at least setValue work correctly, I had to change NexNumber.cpp line 36 from 'utoa' to 'ultoa'. All in all, I am wondering if in setValue the size of the variable 'buffer' is big enough. The max value of uint32_t is supposed to be 4294967296. These are already 10 digits, and the string previx "obj.val=" is still missing. So 'buffer[10]' seems to be far too small and we are risiking a buffer overflow, aren't we?

With the above changes, I could make at least setValue work. But getValue still does not work although the code in NexHardware.cpp recvRetNumber, line 45 seems to be correct and ready for 4 byte uint32_t's. What's going on on the Nextion display side?

testNextionNumberBox.zip

Nextion and Due

What I need to do to make this library works with Arduino DUE?

I've already level shifted it from 5v to 3.3v, only need a working library.

Sending commands based on only the object name is confusing and error-prone

Its more of a design descicion in the Nextion firmware than the lib here, but still ...

It took me quite some time to realize that all command regarding components on te nextion are send using the component ObjName as the identifying element, while th object name can easily appear on multiple pages. This means that I have to check and control on the arduino which components I can reach and which I don;t.

It would be a major improvement if identifiation of componts would be by PageId and ObjId .. (i would think they are made for this).

It does mean that the GUI editor for Nextion should keep its hands off of the PageIds and ObjIds of exisiting component and not start renumbering them while addng or moving components around

setVal function is not working correctly on 8bit avr

Hello,
On my 8bit avrs (like Arduino Leonardo)
setVal function is not converting numbers larger than 16bit
(input number of 6900 is converted to 3464)

Solution I used:
changed
utoa(number, buf, 10);
to
sprintf (buf, "%lu", number);

NexUpload.cpp

It's not possible to compile for some Arduino Boards which are not compatible with the Libary "SoftwareSerial". Probably it would be good, to switch off the #include from the config-File.

File NexUpload.cpp.
17 //#include <SoftwareSerial.h>
18
19 //#define USE_SOFTWARE_SERIAL
20 #ifdef USE_SOFTWARE_SERIAL

Comment out the Line 17 to compile for Arduino DUE which is using the 3 Uarts.

Thanks

Only one callback function

in project i have 12 pages with cca 150 buttons where many buttons has same functionality
now i have to create many NexText and NexButton object and create callback function with parameter "void *ptr" for each object

maybe would be better have only one callback function with parameter "NexObject *ptr"

Zero - SAMD

Hi
Arduino zero, SAMD, do not accept #include <SoftwareSerial.h>
Can please you move inside #ifdef USE_SOFTWARE_SERIAL ?

/**
* @file NexUpload.cpp
*
* The implementation of download tft file for nextion. 
 *
* @author  Chen Zengpeng (email:<[email protected]>)
* @date    2016/3/29
* @copyright 
 * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*/

#include "NexUpload.h"

//#define USE_SOFTWARE_SERIAL
#ifdef USE_SOFTWARE_SERIAL
#include <SoftwareSerial.h>
SoftwareSerial dbSerial(3, 2); /* RX:D3, TX:D2 */
#define DEBUG_SERIAL_ENABLE
#endif

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.