Start a new topic

NexScrolltext

How do I use this in Arduino this is what I have tried


#include "Nextion.h"

NexScrolltext g0 = NexScrolltext (1,21, "Start");


I get this error


 

Arduino: 1.8.1 (Windows 10), Board: "Adafruit Feather M0"

Receive:45: error: 'NexScrolltext' does not name a type

 NexScrolltext g0 = NexScrolltext (1,21, "Start");

 ^
exit status 1
'NexScrolltext' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

 

I know that I am doing something wrong is there any help files on NexScrolltext ?


Arduino.cc forums for this level of Arduino help.

  

#include "Nextion.h"
NexScrolltext g0 = NexScrolltext (1,21, "Start");

 

Successfully Compiles.

Receive:45: error:

  says error is on line 45

what you provided doesn't contain such error, and no 45 lines

It will not compile for me

Sorry Line 45 is NexScrolltext g0 = NexScrolltext (1,21, "Start");


Should I have a NexScrolltext.h?

here is a new sketch



 

#include "Nextion.h"
NexScrolltext g0 = NexScrolltext (1,21, "Start");
void setup() {
  // put your setup code here, to run once:

}

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

}

 and I get this error


 

Arduino: 1.8.1 (Windows 10), Board: "Adafruit Feather M0"

sketch_may10b:2: error: 'NexScrolltext' does not name a type

 NexScrolltext g0 = NexScrolltext (1,21, "Start");

 ^

exit status 1
'NexScrolltext' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

 


Sorry when you refuse to provide details, I will not guess and try mind meld.

When I compiled the two code lines you provided in new sketch, it compiles.

Exactly the same as your posted new sketch (see attached below).


Since your issues seem to not resolve, may I recommend Arduino.cc forum.

 - you  will need to learn more about your compiler, and how to use libraries.

ino
(202 Bytes)

Wow,


I have purchased 30 of your screens last year and have used them with success and was wanting to use a few of the new features like NexProgressBar and NexScrolltext but both without any success if you could have a little patience with me I think that we can find out what is going on!


Like I said other Components work fine just not NexProgressBar and NexScrolltext I can change text I can change a page but not set the var on NexProgressBar or even get NexScrolltext to compile.

I have found the first issue I must have selected vscope as global not local on the NexProgressBar works as expected I have no idea how I did that!


Now if I can get NexScrolltext to compile

My time to answer questions on the forum is voluntary.  And indeed over the last year of doing so, I enjoy answering Nextion related questions and taking Nextion beyond its original design.

- but I don't teach electronics

- I don't teach MCU programming

Electronics and the programming for user chosen MCU is user domain.

Nextion supports over 10,000 MCUs, and 100+ programming languages.

I go over Nextion side coding techniques, but user MCU is for the user to do.


Have a read to Nextion TTL Serial

http://support.iteadstudio.com/support/discussions/topics/11000012112


Commands like page0.g0.en=1ÿÿÿ and page0.j0.val=43ÿÿÿ are sent over serial

 - how you do that in your chosen language for your chosen MCU, you must know.

 - how to use your compiler, how to read your source code, and library sources.

the .h files contain your function prototypes that are implemented in the .cpp files


You two questions today show you need more help, but not for Nextion HMI design

 - but for Arduino MCU and Arduino C++ in the Arduino IDE

For this I pointed you in the direction (Arduino.cc) where it is specific to your needs.

If you were using mikroPascal for an STM MCU,

 - I'd recommend reading the spec sheets, checking st.com and mikroe forums.


So you need to know how to check Nextion.h, NexProgressBar.h and NexScrolltext.h

You need to know what your compiler errors like does not name a type mean

and knowing what they mean you'll know how to fix them.

You need to know how to install libraries, and work with your compiler.


I can make a guess that your library wasn't installed properly and your compiler

is missing access to these files, and so is not including them at compile time.

- this is based that I can compile the minimal sketch while yours is throwing the error.


But you want to argue against providing the details, and so mine is only a guess.

MCU programming as stated is exacting, but of 45+ lines you provide two.

So such Arduino help indeeds to come from Arduino.cc forums.

I did indeed just check and NexScrolltext.h is not there Thank you for your time 

I have found the first issue I must have selected vscope as global not local on the NexProgressBar works as expected I have no idea how I did that!


Unfortunately this is not solid logic as the .vscope setting doesn't effect an MCU side compile.

.vscope says whether or not dynamic attributes of the component are globally accessible.

The normal processing of a component is local


This means when the page is current on the HMI, then these components are loaded in Nextion

When the page changes away from, they are unloaded.  Page by page.

When .vscope is set to global, the attributes (not Event code) is available globally.


But again, this does not effect an MCU side compile, it may effect runtime.  Not compile



You are right.


If I install the new 0.9.0 Library for Nextion everything works with the Arduino mega put if I use the Feather I get a error that I did not get before the new library


D:\Arduino\Chris's\libraries\ITEADLIB_Arduino_Nextion-master\NexUpload.cpp:17:28: fatal error: SoftwareSerial.h: No such file or directory #include <SoftwareSerial.h> ^ compilation terminated. exit status 1 Error compiling for board Adafruit Feather M0. 


I guess that the Feather does not like SoftwareSerial! Any ideas how to fix this? Thanks

I looked at NexUpload.cpp and it does use SoftwareSerial how would I disable this?

 

#include "NexUpload.h"
#include <SoftwareSerial.h>

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

 


Here is what I did So Far So Good


 I change above to this:

#include "NexUpload.h"
#include <SoftwareSerial.h>

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

 


Everything is now working fine thank you for your help and understanding.

Login or Signup to post a comment