1

I am using Arduino Uno R3 board with Atmega 328p microcontroller along with an ethernet shield for showing tempererature over a network. However i am facing a problem that the FULLD(full duplex for communication) led on the ethernet shield is not solid. Hence I am unable to access the provided IP in my web browser. Apart from that when I directly connect it to my PC, the same thing happens. The FULLD led keeps blinking and i am unable to establish a solid contact. My code goes here:

#include <SPI.h>
#include <Ethernet.h>
#include <OneWire.h>
#include <DallasTemperature.h>


#define ONEWIRE 7
#define SENSOR_READ_TIMEOUT 8000 

OneWire oneWire(ONEWIRE);
DallasTemperature sensors(&oneWire);
EthernetClient client;
EthernetServer server(8080);

byte mac[] = {
  0xF0, 0xBF, 0x97, 0x67, 0xF6, 0x98
};
IPAddress ip(192, 168, 43, 94);

void setup() {
    Serial.begin(9600);
    pinMode(4, OUTPUT);
    digitalWrite(4, HIGH);
    Serial.println("Boot");
    sensors.begin();
    delay(1000);
    Serial.print("OneWire Digital Pin Specified: ");
    Serial.println(ONEWIRE);
    Ethernet.begin(mac,ip);
    server.begin();
    delay(3000); 

}

 void loop() {
   static unsigned long sensorPrevTime = 0; 
   server.begin();
   EthernetClient client = server.available();  
   Serial.print(".");
   sensors.requestTemperatures(); 
   float tempC1 = sensors.getTempCByIndex(0);
   float tempC2 = sensors.getTempCByIndex(1);
   if (millis() - sensorPrevTime > SENSOR_READ_TIMEOUT) {
   Serial.println();
   Serial.println("Requesting temperature...");  
   Serial.print("Sensor 2:    ");
   Serial.print(tempC1);
   Serial.println(" C ..........DONE");
   Serial.print("Sensor 1:    ");
   Serial.print(tempC2);
   Serial.println(" C ..........DONE");
   if (client) {  
   Serial.println("new client");
   boolean currentLineIsBlank = true;
   while (client.connected()) {
      if (client.available()) {
      char c = client.read();
      Serial.write(c);
      if (c == '\n' && currentLineIsBlank) {
        client.println("HTTP/1.1 200 OK");
        client.println("Content-Type: text/html");
        client.println("Connection: close");
        client.println("Refresh: 2");
        client.println();
        client.println("<!DOCTYPE HTML>");
        client.println("<html>");
        client.print("Temperature for Requested Area is: ");
        client.print(tempC1);
        client.print(" C ");
        client.println("<br />");
        client.print("Reference Temperature is: ");
        client.print(tempC2);
        client.print(" C ");
        client.println("<br />");
        client.println("</html>");
        break;
      }
      if (c == '\n') {
        // you're starting a new line
        currentLineIsBlank = true;
      }
      else if (c != '\r') {
        // you've gotten a character on the current line
        currentLineIsBlank = false;
      }
    }
  }
  delay(1);
  client.stop();
  Serial.println("client disconnected");
 }
 sensorPrevTime = millis();
}


delay(1000); //slow down loop
}
  • Question asked over 4 years ago. OP last seen the day after the question was asked. – VE7JRO Aug 24 at 17:52

Browse other questions tagged or ask your own question.