I have included it in both the sketch, and both library files (linked below). In the sketch file, EthernetClient is recognized and italicized, but neither occur in the library files. Upon compiling, I get an error stating that EthernetClient client is not declared, and that it later believes it to be an int. Any ideas?
interactSD.h:
#ifndef interactSD_h
#define interactSD_h
#include <SPI.h>
#include <SD.h>
#include "Arduino.h"
#include <Ethernet.h>
class interactSD
{
public:
interactSD();
void readFile(File userFile, EthernetClient client);
void getFileName();
void removeFile();
void writeFile(File userFile);
char fileName[];
String userInput;
}
;
#endif
interactSD.cpp:
#include "Arduino.h"
#include "interactSD.h"
#include <SPI.h>
#include <SD.h>
#include <Ethernet.h>
void interactSD::readFile(File userFile, EthernetClient client) //prints all available bytes on a .txt file, adjusted for client
{
if (userFile) {
while (userFile.available()) {
client.write(userFile.read());
}
}
else {
client.println("Error opening file...");
}
userFile.close();
client.println("done");
}
(other methods...)
Snippets from main sketch:
void loop() {
EthernetClient client = server.available();
---
switch (thisChar) {
case 2:
client.println("(5 second timeout)");
client.println("temp: 0");
client.println("mic: 1");
delay(5000);
thisChar = client.read() - '0';
switch (thisChar) {
case 0:
userFile = SD.open("temp.txt"); //open and read temp.txt contents
sd.readFile(userFile, client);
thisChar = 9; //sets arbitrary value so it won't trigger accidentally
break;
case 1:
userFile = SD.open("mic.txt"); //open and read mic.txt contents
sd.readFile(userFile, client);
thisChar = 9; //sets arbitrary value so it won't trigger accidentally
break;
default:
client.println("Invalid input!");
break;
}
thisChar = 9; //sets arbitrary value so it won't trigger accidentally
client.println("Logging...");
break; //loops back into the logging function
}
}