Why wont any sketches work on my Arduino ide 1.6.13

Why do I get error messages for every sketch I attempt to use from the internet. when the sketch calls for #include----- then I include what it calls for.
here is an example sketch I am trying to use for a Nextion display tutorial.

#include <Nextion.h>

/**

  • @example CompSlider.ino
  • @par How to Use
  • This example shows that ,when the slider component on the Nextion screen is released,
  • the text value of text component will be changed every time.
  • @author Wu Pengfei (email:pengfei.wu@itead.cc)
  • @date 2015/8/11
  • @updated 2016/12/25 bring HMI up to v0.32 to avoid too old issues
  • @convert by Patrick Martin, no other changes made
  • @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 “Nextion.h”

NexText t0 = NexText(0, 2, “t0”);
NexSlider h0 = NexSlider(0, 1, “h0”);

NexTouch *nex_listen_list =
{
&h0,
NULL
};

void h0PopCallback(void *ptr)
{
uint32_t number = 0;
char temp[10] = {0};

dbSerialPrintln(“h0PopCallback”);

h0.getValue(&number);
utoa(number, temp, 10);
t0.setText(temp);
}

void setup(void)
{
nexInit();
h0.attachPop(h0PopCallback);
dbSerialPrintln(“setup done”);
}

void loop(void)
{
nexLoop(nex_listen_list);
}

and here is the error messages

Arduino: 1.6.13 (Windows 10), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

C:\Users\Jim\Documents\Arduino\libraries\NexConfig\NexHardware.cpp:18:25: error: conflicting declaration ‘SoftwareSerial Serial2’

SoftwareSerial nexSerial(10, 11); // RX, TX

^

In file included from C:\Users\Jim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.17\cores\arduino/Arduino.h:232:0,

from C:\Users\Jim\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion/NexHardware.h:17,

from C:\Users\Jim\Documents\Arduino\libraries\NexConfig\NexHardware.cpp:15:

C:\Users\Jim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.17\cores\arduino/HardwareSerial.h:151:25: note: previous declaration as ‘HardwareSerial Serial2’

extern HardwareSerial Serial2;

^

Multiple libraries were found for “SoftwareSerial.h”
Used: C:\Users\Jim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.17\libraries\SoftwareSerial
Not used: C:\Users\Jim\Documents\Arduino\libraries\SoftwareSerial
Multiple libraries were found for “SPI.h”
Used: C:\Users\Jim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.17\libraries\SPI
Not used: C:\Users\Jim\Documents\Arduino\libraries\SPI
Multiple libraries were found for “SD.h”
Used: C:\Users\Jim\Documents\Arduino\libraries\SD
Not used: C:\Users\Jim\Documents\Arduino\libraries\arduino_410198
Not used: C:\Program Files (x86)\Arduino\libraries\SD
Multiple libraries were found for “Nextion.h”
Used: C:\Users\Jim\Documents\Arduino\libraries\Nextion.h
Not used: C:\Users\Jim\Documents\Arduino\libraries\nextion
Not used: C:\Users\Jim\Documents\Arduino\libraries\arduino_425685
Not used: C:\Users\Jim\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion
Multiple libraries were found for “NexConfig.h”
Used: C:\Users\Jim\Documents\Arduino\libraries\NexConfig
Not used: C:\Users\Jim\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

This is similar to every error message I get for every sketch I try.
Could someone tell me what am I doing wrong

You are not installing the libraries correctly.
Looks like you have many libraries all with the same thing in them.

would you suggest I go through the above error codes and delete some of those "not used" sketches?
If so, will that help?

In NexHardware.cpp it declares an instance of SoftwareSerial... and names it Serial2.

Serial2 is already declared by the default Arduino core as an instance of hardware serial on the Mega, so using the same name for an instance of SoftwareSerial is not valid.

So would you guys suggest that I delete all I have done in the last two months (none of it works anyway) and start over going slower and being more careful.

Robotjam:
So would you guys suggest that I delete all I have done in the last two months (none of it works anyway) and start over going slower and being more careful.

Or you could resolve the Serial2 problem and see if you can get back to not working the same as before.

Ok guys thank you so far for the help. I have made a few deletions from my libraries file and a few smaller changes.
Here is the error message I get now

Arduino: 1.6.13 (Windows 10), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

In file included from C:\Users\Jim\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion\examples\CompSlider\CompSlider_v0_32\CompSlider_v0_32.ino:20:0:

sketch\Nextion.h:25:23: fatal error: NexButton.h: No such file or directory

#include “NexButton.h”

^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

The error message says to #include “NexButton.h” but every time I do it then tells me to include a different file and after I do that it then tells me to include a different file, I have done this for up to six different “includes”. Should I keep doing this for however many times it says or what. Damn I hate being new and not knowing much.

I am also including a screenshot of the other files included when I click on the “CompSlider_Vv0_32.ino” file. I did not add these they just show up every time I open the .ino file.

Capture1.JPG

The error message says to #include "NexButton.h" but every time I do it then tells me to include a different file and after I do that it then tells me to include a different file, I have done this for up to six different "includes". Should I keep doing this for however many times it says or what. Damn I hate being new and not knowing much.

A better option would be to close the Arduino IDE for a minute and go read the docs on that library. It probably tells you what needs to be included.

When you're frustrated with not knowing, reading is almost always a good answer.

I did not add these they just show up every time I open the .ino file.

Those tabs are used to split up code. They are files inside your CompSlider_v0_32 folder.

So you should not #include it, it gets added into the code after the main window.

It will help immensely if you post the link to where you got that code so we can try it.

Ok here is the YouTube video tutorial I have been following

There is a link in his description that takes you to here,

Click on examples, then CompSlider and that will take you to the files I have been working on

OK I tried this with no errors at all. I used a Mega.

When you downloaded ITEADLIB_Arduino_Nextion-master.zip and then decompressed it to get the folder ITEADLIB_Arduino_Nextion-master, did you then rename the folder ITEADLIB_Arduino_Nextion before dragging it into the libraries folder? The restart the Arduino IDE?

I did get an error with the Uno but then there are configuration notes in the read.me file that tells you about that.

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

Yes I did that, in fact I just now deleted that folder and redid that and I still get the same errors.

Arduino: 1.6.13 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\Jim\Documents\Arduino\libraries\NexConfig\NexHardware.cpp:18:25: error: conflicting declaration 'SoftwareSerial Serial2'

SoftwareSerial nexSerial(10, 11); // RX, TX

^

In file included from C:\Users\Jim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.17\cores\arduino/Arduino.h:232:0,

from C:\Users\Jim\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion/NexHardware.h:17,

from C:\Users\Jim\Documents\Arduino\libraries\NexConfig\NexHardware.cpp:15:

C:\Users\Jim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.17\cores\arduino/HardwareSerial.h:151:25: note: previous declaration as 'HardwareSerial Serial2'

extern HardwareSerial Serial2;

^

Multiple libraries were found for "SD.h"
Used: C:\Users\Jim\Documents\Arduino\libraries\SD
Not used: C:\Users\Jim\Documents\Arduino\libraries\arduino_410198
Not used: C:\Program Files (x86)\Arduino\libraries\SD
Multiple libraries were found for "NexConfig.h"
Used: C:\Users\Jim\Documents\Arduino\libraries\NexConfig
Not used: C:\Users\Jim\Documents\Arduino\libraries\ITEADLIB_Arduino_Nextion
Multiple libraries were found for "SoftwareSerial.h"
Used: C:\Users\Jim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.17\libraries\SoftwareSerial
Not used: C:\Users\Jim\Documents\Arduino\libraries\SoftwareSerial
Multiple libraries were found for "SPI.h"
Used: C:\Users\Jim\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.17\libraries\SPI
Not used: C:\Users\Jim\Documents\Arduino\libraries\SPI
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

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

I am using a Win 10 machine and the Arduino 1.6.13 IDE. I too am using a mega, just not an official $45 dollar mega. I am going to delete all "not used" parts of the error but I have no idea about the rest.

Keep in mind this sketch is not important for a project but it is part of a tutorial that I want to figure out because I keep getting very similar error messages for every sketch I try.

Hi,

Keep in mind this sketch is not important for a project but it is part of a tutorial that I want to figure out because I keep getting very similar error messages for every sketch I try.

What other sketches?
Have you tried any from the Example list that use libraries to see if they compile?

Tom.... :slight_smile:

Why use software serial when a Mega has 4 hardware serial ports?
use these instead
Serial1, Serial2, Serial3
just like using Serial,
with Serial1.available(), Serial1.read, Serial1.print or Serial1.write commands, etc.

Could also try moving to 1.8.1

Ok for Tom George most of the sketches don't use libraries, as far as I can tell, and the ones I tried seemed to compile correctly, I did find one example called "Keyboard and Mouse Control" that did use libraries and did not compile correctly. If you want to see the error messages just let me know and I will enclose it.

For Crossroads please don't take this the wrong way but I have absolutely no idea why your asking about software serial. I am sitting here staring at the code and I can see nowhere does it say anything about software serial except in the error messages. I don't know where this comes from. Earlier I was told to go into the NexConfig.h file where I was told to comment out "the declarations inside the NexConfig.h file for nexSerial ". While I looked at that file I didn't find those lines to comment out, (and for the record I think I know how to comment out //)

Also you mention moving up to a newer version of the Arduino IDE but in some of my internet travels I have read that what might work on one version most likely wont work on a different version SO I AM NERVOUS ABOUT UPGRADING.

sorry bout the capitals i must have accidently hit the caps lock

Robotjam:
Also you mention moving up to a newer version of the Arduino IDE but in some of my internet travels I have read that what might work on one version most likely wont work on a different version SO I AM NERVOUS ABOUT UPGRADING.

Where did you read that? There is a possibility that something might not work with a different version, but I wouldn't say most likely. Not even close to most likely. Most likely it will work fine.

If I did upgrade would I still get the same error messages or would the newer version help me to understand better where I am screwing up?

It would probably be exactly the same. But it might not be. One of the cool things about the IDE is that you can have multiple versions installed at once.