Go Down

Topic: verify code fails, error output shows a library that it isnt using (Read 465 times) previous topic - next topic


Hi I am verifying my code and it's failing when I check the output it shows a reference to the Ethernet library.  I am not using this library(I am using Ethernet2 which is also included in the output).

I have copied the code to a new project restarted the app but it doesn't make a difference.  How do remove this invalid reference?

Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI
Using library Ethernet2-1.0.4 at version 1.0.4 in folder: C:\Program Files (x86)\Arduino\libraries\Ethernet2-1.0.4
Using library LiquidCrystal at version 1.0.7 in folder: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal
Using library SD at version 1.1.1 in folder: C:\Program Files (x86)\Arduino\libraries\SD
Using library IniFile-master at version 1.0.0 in folder: C:\Program Files (x86)\Arduino\libraries\IniFile-master
Using library Ethernet at version 1.1.2 in folder: C:\Program Files (x86)\Arduino\libraries\Ethernet
Using library MUX74HC4067-master in folder: C:\Program Files (x86)\Arduino\libraries\MUX74HC4067-master (legacy)

Code: [Select]
#define NUM_ZONES (63)

#include <SPI.h>       
#include <Ethernet2.h>
#include <LiquidCrystal.h>
#include <SD.h>
#include <IniFile.h>
#include "MUX74HC4067.h"

LiquidCrystal *pLCD = NULL;
MUX74HC4067 *pmux1 = NULL;

//check the mac address
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {192,168,0,170};

EthernetClient client ;

// The select pin used for the SD card
#define SD_SELECT 4

//Lcd pins these need to read off ini file
String rs;
String en;
String d4;
String d5;
String d6;
String d7;

//Mux's variables
String Mux1en;
String Mux1s0;
String Mux1s1;
String Mux1s2;
String Mux1s3;

//arrays to check if button has changed
int previousState[NUM_ZONES]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
//int previousState[NUM_ZONES]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
//Command to pass to homeseer
char* myStrings[64];

//SubRoutine For Error Messages Reading SD card
 void printErrorMessage(uint8_t e, bool eol = true)
  switch (e) {
  case IniFile::errorNoError:
    Serial.print("no error");
  case IniFile::errorFileNotFound:
    Serial.print("file not found");
  case IniFile::errorFileNotOpen:
    Serial.print("file not open");
  case IniFile::errorBufferTooSmall:
    Serial.print("buffer too small");
  case IniFile::errorSeekError:
    Serial.print("seek error");
  case IniFile::errorSectionNotFound:
    Serial.print("section not found");
  case IniFile::errorKeyNotFound:
    Serial.print("key not found");
  case IniFile::errorEndOfFile:
    Serial.print("end of file");
  case IniFile::errorUnknownError:
    Serial.print("unknown error");
    Serial.print("unknown error value");
  if (eol)

void setup()
  //Config and read SD card
  // Configure all of the SPI select pins as outputs and make SPI
  // devices inactive, otherwise the earlier init routines may fail
  // for devices which have not yet been configured.
  digitalWrite(ETHERNET_SELECT, HIGH); // disable Ethernet
  const size_t bufferLen = 80;
  char buffer[bufferLen];
  const char *filename = "/config.ini";
  if (!SD.begin(SD_SELECT))
    while (1)
      Serial.println("SD.begin() failed");
  IniFile ini(filename);
  if (!ini.open()) {
    Serial.print("Ini file ");
    Serial.println(" does not exist");
    // Cannot do anything else
    while (1)
  Serial.println("Ini file exists");

  // Check the file is valid. This can be used to warn if any lines
  // are longer than the buffer.
  if (!ini.validate(buffer, bufferLen)) {
    Serial.print("ini file ");
    Serial.print(" not valid: ");
    // Cannot do anything else
    while (1)
 // Fetch a value from a key which is present
 // get data from sd card and write to array
Serial.println("getting Homesser commands");
   for (int j=0; j<=63; j=j+1) {
        char mpass[ ] = "command"  ;     
        int num = j;
        char cstr[16];
        itoa(num, cstr, 10);
        if (ini.getValue("HSCOMMANDS",mpass, buffer, bufferLen)) {
        myStrings[j] = buffer;

  Serial.println("getting LCD");
 //get the lcd screen pins
 if (ini.getValue("LCD", "rs", buffer, bufferLen)) {
   rs = buffer;

 if (ini.getValue("LCD", "en", buffer, bufferLen)) {
  en = buffer;

if (ini.getValue("LCD", "d4", buffer, bufferLen)) {
   d4 = buffer;

if (ini.getValue("LCD", "d5", buffer, bufferLen)) {
   d5 = buffer;

if (ini.getValue("LCD", "d6", buffer, bufferLen)) {
   d6 = buffer;

if (ini.getValue("LCD", "d7", buffer, bufferLen)) {
   d7 = buffer;
pLCD = new LiquidCrystal(rs.toInt(), en.toInt(), d4.toInt(), d5.toInt(), d6.toInt(), d7.toInt());

//Mux set up
if (ini.getValue("MUX1", "en", buffer, bufferLen)) {
   Mux1en = buffer;  //  Mux1en = 22;
if (ini.getValue("MUX1", "s0", buffer, bufferLen)) {
   Mux1s0 = buffer; //   Mux1s0 = 23;
if (ini.getValue("MUX1", "s1", buffer, bufferLen)) {
   Mux1s1 = buffer; //   Mux1s1 = 24 ;
if (ini.getValue("MUX1", "s2", buffer, bufferLen)) {
   Mux1s2 = buffer; //   Mux1s2 = 25 ;
if (ini.getValue("MUX1", "s3", buffer, bufferLen)) {
   Mux1s3 = buffer; //  Mux1s3 = 26;

pmux1 = new MUX74HC4067(Mux1en.toInt(), Mux1s0.toInt(), Mux1s1.toInt(), Mux1s2.toInt(), Mux1s3.toInt());

// Configures how the SIG pin will be interfaced e.g. The SIG pin connects to PIN 3 on the Arduino and PIN 3 is a digital input
pmux1->signalPin(27, INPUT, DIGITAL);

// set up the LCD's number of columns and rows:  Print a message to the LCD.
pLCD->begin(20, 3);
pLCD->print("loaded ini");
Serial.println("loaded ini");

//Network card setup
digitalWrite(ETHERNET_SELECT, LOW); // enable Ethernet this is turned on after SD reader finished with SPI pins
digitalWrite(SD_SELECT, HIGH); // Disable SD card
Ethernet.begin(mac, ip);

pLCD->print("loaded ini");
pLCD->setCursor(0, 1);

void loop()

byte data;
String hsCommand;
String mypass;
  for (byte i = 0; i < 16; ++i)
    // Reads from channel i and returns HIGH or LOW
    //when ALL 4 MUX IN THEN loop 0 63 and split by 16 each mux
    data = pmux1->read(i);
  Serial.print("posistion ");
  Serial.print("value ");
    if ((data == HIGH) && (previousState[i] == LOW ))  {   
              //call homeseerpost turning on
              Serial.println("in on if statement");             
              mypass = String(myStrings[i]) + "&label=off";
              sendHomeSeerCommand(mypass );
    else if ((data == LOW) && (previousState[i] == HIGH )) {
            // call homeseerpost turning off
            Serial.println("in Off if statement");
            mypass = String(myStrings[i]) + "&label=on";
    previousState[i] = data;
  void sendHomeSeerCommand(String HScommand)
    byte server[] = { 192,168,0,60 };
    String url = "/JSON?request=controldevicebylabel&ref=" + HScommand ;
    int ret = client.connect(server, 8080) ;
     if (ret==1)
        client.print("GET " + url + " HTTP/1.1\r\n" +
                     "Host: " + "\r\n" +
                     "Connection: close\r\n\r\n");   
    else {
    Serial.println("connection failed");


Also posted at:
If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. When you post links please always use the chain links icon on the toolbar to make them clickable.

Post a link to where you got the IniFile library from. Please use the chain links icon on the toolbar to make it clickable.


Sorry yes I will do that in the future.

Here is where I got the ini library from

ini library


The problem is that the IniFile library unnecessarily uses Ethernet.h.

Do this:
  • File > Examples > IniFile > IniFileExample
  • Sketch > Show Sketch Folder
  • Navigate up two folder levels.
  • Open the src folder.
  • Open the file IniFile.h in a text editor.
  • Change line 11 from:

Code: [Select]
#include "Ethernet.h"
Code: [Select]
#include "IPAddress.h"
  • Save the file.

I have submitted a pull request to the library author to make this change upstream:


Thanks I have made the change but getting the error below

C:\Program Files (x86)\Arduino\libraries\IniFile-master\src/IniFile.h:11:22: fatal error: IPAdress.h: No such file or directory

 #include "IPAdress.h"


compilation terminated.


You missed a "d". I told you to write this:
Code: [Select]
#include "IPAddress.h"
but you wrote this:
Code: [Select]
#include "IPAdress.h"


Thanks I made the change and worked, I looked at it yesterday and I just couldn't see I had missed the "D"

thanks again.

Go Up