I'm lost, This is printing jibberish.
void Ethercheck(){
//Ethernet Client
if (client.connected()) {
if (client.available()) {
// read incoming bytes:
char inChar = client.read();
//Serial.print (inChar);
// add incoming byte to end of line:
currentLine[currentIndex++] = inChar;
currentLine[currentIndex] = '\0';
Serial.print (currentLine);
// if you get a newline, clear the line:
if (inChar == '\n') {
previousTweet == tweet;
}
// if the current line contains <text>, it will
// be followed by the tweet:
if (strncmp(currentLine,"<text>",6)==0) {
// tweet is beginning. Clear the tweet string:
readingTweet = true;
}
// if you're currently reading the bytes of a tweet,
// add them to the tweet String:
if (readingTweet) {
if (inChar != '<') {
tweet[tweetIndex++] = inChar;
tweet[tweetIndex] = '\0';
}
else {
// if you got a "<" character,
// you've reached the end of the tweet:
readingTweet = false;
if (tweet != previousTweet){
Serial.println(F("TWEET"));
Serial.println(tweet);
// close the connection to the server:
Serial.println(F("disconnecting"));
client.stop();
if (firstTweetRead != false){
if (strncmp(tweet,makeCoffee, 16)==0) {
//if( waterLevel is higher than said amount){
Serial.println (F("Making coffee"));
tweetString.begin();
tweetString = " Making coffee now, random number: ";
randNumber = random(1000);
tweetString.print (randNumber);
make();
}
}
else{
firstTweetRead = true;
}
}
else {
Serial.println(F("no new tweets"));
Serial.println(F("disconnecting"));
client.stop();
}
}
}
}
}
else if (millis() - lastAttemptTime > requestInterval) {
// if you're not connected, and fifteen seconds have passed since
// your last connection, then attempt to connect again:
client.flush();
totalCount++;
Serial.print (F("Total count:"));
Serial.println(totalCount);
connectToServer();
}
}