Start a new topic

NexSerial problem with Arduino UNO

Due to my "lack of programming skill" i didn't succed in solving this error:

"C:\Users\....\ARDUINO\sketches\SINGLE\NextionPompe_prova02-Offlib\NextionPompe_prova02-Offlib.ino: In function 'void setup()':


NextionPompe_prova02-Offlib:63: error: 'nexSerial' was not declared in this scope





Dispite I've declared "SoftwareSerial nexSerial(10,11);", it's not working.
I tried other suggestions I've red in here, but with no success.

I'm using last Library (0.9.0). On GitHub.

Can anybody help me please? 

many thanks

Ahhh, programming of logic and the learning journey to Arduino C++

- why those little chips just cannot be programmed via telepathy in 2017

  should have easily been accomplished shortly after 1984 (Orwell) =)

There is much to programming the UNO

 - the specifications for this one only has but one Hardware Serial and

   you and have disadvantaged yourself out of the gate in choosing it.

As it has only one Serial, that one Serial can be used for Nextion or your Serial Monitor, and you get to choose which.  If your choice finally becomes to use the one Serial for Nextion - the instructions are clearly laid out on the .github page.  which is also the file called in your local library files in the libraries directory on your computer (placed there after a proper install of the library).

SoftwareSerial is bit-banged and they have not managed perfect ease with this one even though they have tried many author's renditions for SoftwareSerial.  It will forever be good for some purposes while other libraries are good for other purposes.  Such is the reason why a Hardware Serial is indeed desired.


nexSerial is a define, and for defines you must again research what the purpose of a define is in the Arduino C++ scheme.  As such your declaration

SoftwareSerial nexSerial(10,11); 

will not work in this fashion as the define will alter this line before compile time, rendering it into something other than expected - but the Iteadlib does not use SoftwareSerial for its main communications. 

Already invoking the MIT licence to change and modify to suit your tastes is perhaps bold when just learning to program, if you modify without understanding what you are modifying may already be a path that deletes your changes, reinstalls the Iteadlib, and effectively brings you back to "Square One".  Square One will become a spot of comfort from familiarity.  Hello Square One. =)

So in short your journey will require

- learning the Arduino C++ language (Reference section of

- learning about Serial and SoftwareSerial (

- learning the hardware specifications for the UNO (

- reading the manual for the UNO (linked on UNO page at

- having questions related to Arduino C++ asked and answered in Arduino Forum

Arduino C++ may be close to being C++, but is their own flavour of watered down C++ and as such some rules work, and some rules well, some do not.

But success for Iteadlib and UNO as supported follows the path of

 - making the changes as per the for NexConfig.h

 - use the one Serial for Nextion's exclusive use

 - forego SerialMonitor (ahh, who needs a debugging window anyways)

 - and wonder why programming via telepathy hasn't been implemented.

As per the specific error spit into the Arduino IDE each error is specific

 - this is the reason for why your program will not be running this time.

 - it gave File, Line Number of offence, and the offence

however, only the first error in a list is important

  - errors below the first may be a result of the first error

Fix the first, perhaps many more errors correct on your fix

In this case, your offence was

   'nexSerial' was not declared in this scope

Now on your journey to Arduino C++ enlightenment you may like to find out what scope is and when is something declared within and not within this scope (Scope in this case is not the mouthwash Brand).  This will tell you how to declare within scope - if doing so is indeed what you want to do, or you may want to take another route entirely, in which case you have learned about scope and how to use or avoid it.

But an MCU will only do exactly as instructed by the programmer,

 - they do it trustingly with such blind faith in their programmer

   that they will even attempt to execute the command that is their demise

And that is when that short puff of magic white smoke occurs

  - hopefully when it occurs you at least have the chance to see it

So disappointing when you only get the whiff and didn't get to see it.

"Due to my "lack of programming skill" i didn't succed in solving this error:"

insight and understanding is the first step of improve ... and indeed invest some "more" time on ...



A solution easy and fast is another library i've found
Just tested and "SoftwareSerial" works fine with 10,11 as RX and TX, enough for my needs!.
Thanks to Dan

I found other solutions but haven't tested yet.

one is
" I am willing to share what I know." Gene Dell

Many thanks to Gene Dell.

other on Arduino Forum, and Youtube.
Andreas shows step by step (for beginners) wiring, using hardware tx and rx and monitoring on SoftwareSerial.

Find solutions, spare words, spare time! :-)

have a great day.

so, you already found your answer also for your next questions ...

search, find, spare words, spare (others) time, before you ask ... 

have a great reading and coding ...


1 person likes this

"you already found your answer "

No, i didn't "found". I just asked someone who helped, and suggested me. I asked in another forum and someone reply.  That's why forums exist: ask and give info.

"spare (others) time"

ask for is reasonable, answer is courtesy. 

Did I obliged you answering? Did I forced you, or requested Gerry answering? did I begged you to stalking me? 

I don't know why you started offending and being rude by fooling with me, and replying with useless long-winded, judging me, and following me in any thread like a stalker. 
And honestly i don't care much about... 

maybe you are missing a little detail.
I am the administrator, not you. And it is my task to keep this forum in an order.

People who are just too lazy to read but ask others for help are not the kind of users we like to see here, sorry ...

Peole who think their own time is too valuable to waste for own reading, but expect that others spend their time for them are also not the kind of users we like to see here, sorry ...

Your initial question is already answered many times, search for the threads, read them, understand them, and avoid to became personal and rude ...


The good Dr might note where most of Nextion answers originated from

 - even when told in a tribal manner,

   the one who may have told you was perhaps told by me.

And when I have already spent the time to answer most questions

minimally twice on the forum, and how to send text 100 fold already

on the forum, then people that are too lazy to use the Search bar

above to seek out their answers shouldn't expect others to play librarian.

This is not an Arduino forum - this is a Nextion forum.

Both electronics and programming are prerequisite.

But the self-entitlement of many of the Arduino users ruin for others.

Nextion forum is about what Nextion is capable of doing

 - looking at interesting aspects of what can be accomplished in projects

 - since perverted by self entitlement

     "how do I send text"

     "I don't know what my MCU is"

     "My code won't compile"

     "Here's 5100 lines of code, debug it for me"

     "I can't wire my project", etc

But to post that you don't know what a compile error is and how to resolve?

and then come with such ignorance (unlearned) to not even read the Nextion FAQs?

Then try to spin such a story is pretty arrogant from the unlearned and self-entitled.

Cut Copy Paste without understandings lead to accidents.

Such "unsuccess" to modify NexConfig.h to use with UNO

  comment out one line and set nexSerial's Serial2 to Serial

Such not understanding when on the .github page such is made in the biggest font available

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).

Arduino is less than 0.1% of the MCUs available for Nextion use

But Arduino users seem to demand 99.9% be done for them

 - As told read the manual, learn the compiler tools, learn the language

These YOU chose.

 - you chose the MCU - an Arduino UNO

 - you chose the Language - Arduino C++ (over Basic, Pascal, others)

 - you chose the Compiler - Arduino IDE

So this is your duty to learn your chosen hardware

So had you actually read the .github page or file

 - you would have seen simple instruction to config for your UNO

 - you would be up and running, albeit with only the one Serial

 - you would have you Iteadlib examples HMIs and ino's.

   (which I fixed Christmas Day for such an ungrateful Arduino crew)

The youtube link to Andreas Spiess video would have shown the same.

Gene Dell's link even came with picture how to wire it up

Itead supports its Iteadlib Arduino-Nextion Library

 - but not when people are to lazy to read and change two lines of code.

But feel happy you found Dan's NeoNextion library

 - ask him how to use it when you can't figure it out for your project

 - such is not Itead's, not my job to play school teacher to teach you

 - this forum is not a classroom for programming or electronics.

Ohhh, did Dan quit his little NeoNextion project ... awe.

Pick what hasn't been maintained and updated in mostly a year

and post with such arrogance I found solution ...

 - don't worry, the added extras made since version v0.34 is no importance

    if you don't want to invest your own time to learn your chosen MCU

MCUs require logic

   Only 5 categories and you can't determine which is the one to use.

   Two lines of code to change, can't read instructions or accomplish task

   Search bar at top of every forum page, but you think 35000 videos on

       youtube is authoritative over manufacturer - then spend your 1000 hours

       watching users take 5 mins to stumble with their code, over and over.

   Yeah good luck with that.

But come here to this forum, the topic is Nextion - not Arduino

 - the display is the only thing in common between users

 - no need to tell the community you figured out how to use search

 - no need to tell the community you know what compile error means

 - no need to ask the community for non-Nextion library

When you finally have something Nextion based to contribute to the community

  then feel free discuss Nextion things in the Nextion forum

Stalking in every thread?

 - hardly.  But to ensure thread has correct information stated.