mercredi 25 janvier 2017

Stop arduino loop when a condition is active

I need my code to stop in the loop, i have tried to put in a break but the method sendToGCM() continues. I only want the method to be executed once, the stop while the condition

void loop()
{

  // Other code here giving temp a value

  if (temp > 22)
  {
    status = false;
    value["status"] = status;
    while (temp > 22)
    {
      sendToGCM(); // Sends push notification 
      break;
    }
  }
  else 
  {
    status = true;
    value["status"] = status;
  }
}

Aucun commentaire:

Enregistrer un commentaire