Arduino Yun Process and HttpClient cause program stop


hey there,
i'm using arduino yun control clock. works until arduino-part of yun stops working (takes between 30 mins or 12 hours) while executing 1 of 2 functions. second function (provides clock time update) causes fatal stop, while first function (reads data website switch clock on or off) delays execution of program 30 seconds. ideas how solve problem?

1)

httpclient client;
    client.get("http://xxxxx/xxx/led.txt");

    if (client.available() > 0) {
      char c = client.peek();
    }
    client.flush();

2)

process date;

  if (!date.running())  {
    date.begin("date");
    date.addparameter("+%d-%t");
    date.run();
  }

  string timestring;

  while (date.available() > 0) {
    timestring = date.readstring();
  }

  int firstcolon = timestring.indexof(":");
  int secondcolon = timestring.lastindexof(":");
  int firstslash = timestring.indexof("/");
  int minsign = timestring.indexof("-");

  string daystring = timestring.substring(firstslash + 1, firstslash + 3);
  string hourstring = timestring.substring(minsign + 1, firstcolon);
  string minstring = timestring.substring(firstcolon + 1, secondcolon);
  string secstring = timestring.substring(secondcolon + 1);

  hours = hourstring.toint();
  minutes = minstring.toint();
  seconds = secstring.toint();
  dzien = daystring.toint();
  settime(hours, minutes, seconds, dzien, 00, 00);
  date.flush();
  date.close();


quote
any ideas how solve problem?
which problem? fact takes time process client request not problem. reality. if problem trying address, solution quite simple. take arduino off network. way, clients won't able connect it, there won't pesky clients deal with.

if there other problem, fine folks @ http://snippets-r-us.com able snippets.

ps. rtcs cheap.

pps: pissing away resources on strings not idea.


Arduino Forum > Products > Arduino Yún (Moderator: fabioc84) > Arduino Yun Process and HttpClient cause program stop


arduino

Comments