Go Down

Topic: [SOLVED]Logging multiple temp sensors questions(step by step) (Read 6 times) previous topic - next topic

vespapierre

after removing the lines what I have sent before, the first attempt is failed, and then ok.(second to sixth...)
and logfile ok too

SurferTim


after removing the lines what I have sent before, the first attempt is failed, and then ok.(second to sixth...)
and logfile ok too

So the SD log works as long as you don't call the getPage function? And getPage works all the time?

vespapierre

yes.

this is not commented out:
Code: [Select]
byte getPage(IPAddress ipBuf,char *page)
{
  int inChar;
  char outBuf[128];

  Serial.print(F("connecting..."));

  if(client.connect(ipBuf,80))
  {
    Serial.println(F("connected"));

    sprintf(outBuf,"GET %s HTTP/1.0\r\n\r\n",page);
    client.write(outBuf);
  }
  else
  {
    Serial.println(F("failed"));
    return 0;
  }

  // connectLoop controls the hardware fail timeout
  int connectLoop = 0;

  while(client.connected())
  {
    while(client.available())
    {
      inChar = client.read();
      Serial.write(inChar);
      // set connectLoop to zero if a packet arrives
      connectLoop = 0;
    }

    connectLoop++;

    // if more than 10000 milliseconds since the last packet
    if(connectLoop > 10000)
    {
      // then close the connection from this end.
      Serial.println();
      Serial.println(F("Timeout"));
      client.stop();
    }
    // this is a delay for the connectLoop timing
    delay(1);
  }

  Serial.println();

  Serial.println(F("disconnecting."));
  // close client end
  client.stop();

  return 1;
}

SurferTim

OK, we are down to two main things. It is either the sprintf, or the call to getPage. Uncomment the sprintf statement, but leave the call to getPage commented out. Does the SD log do ok?

vespapierre

with that sprintf , the first log attempt is failed, than ok. logfile ok too! ( just getpage function is commented out)

Go Up