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)
#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
#define ETHERNET_SELECT 10
//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");
break;
case IniFile::errorFileNotFound:
Serial.print("file not found");
break;
case IniFile::errorFileNotOpen:
Serial.print("file not open");
break;
case IniFile::errorBufferTooSmall:
Serial.print("buffer too small");
break;
case IniFile::errorSeekError:
Serial.print("seek error");
break;
case IniFile::errorSectionNotFound:
Serial.print("section not found");
break;
case IniFile::errorKeyNotFound:
Serial.print("key not found");
break;
case IniFile::errorEndOfFile:
Serial.print("end of file");
break;
case IniFile::errorUnknownError:
Serial.print("unknown error");
break;
default:
Serial.print("unknown error value");
break;
}
if (eol)
Serial.println();
}
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";
Serial.begin(9600);
SPI.begin();
if (!SD.begin(SD_SELECT))
while (1)
Serial.println("SD.begin() failed");
IniFile ini(filename);
if (!ini.open()) {
Serial.print("Ini file ");
Serial.print(filename);
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(ini.getFilename());
Serial.print(" not valid: ");
printErrorMessage(ini.getError());
// 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);
strcat(mpass,cstr);
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);
//Serial.println("ready");
pLCD->print("loaded ini");
pLCD->setCursor(0, 1);
pLCD->print("Ready");
}
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);
//tmp
Serial.print("posistion ");
Serial.print(i);
Serial.print("value ");
Serial.println(data);
if ((data == HIGH) && (previousState[i] == LOW )) {
//call homeseerpost turning on
Serial.println("in on if statement");
mypass = String(myStrings[i]) + "&label=off";
//Serial.println(mypass);
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";
sendHomeSeerCommand(mypass);
}
previousState[i] = data;
}
Serial.println();
delay(500);
}
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: 192.168.0.60 " + "\r\n" +
"Connection: close\r\n\r\n");
}
else {
Serial.println("connection failed");
}
}