Back to Parent

//Sending an SMS through ifttt.com
//Add the following before void setup()

unsigned long lastPublishTime=0;


//Update the void loop() with the sendSMS(); method

void loop ()
{
  if(isNearMagnet()) 
  {
    turnOnLED();
    sendSMS();
  }
}

//Add the following to a new method below the void loop()

void sendSMS()
{ 
  if (millis()-lastPublishTime>60000)
  { 
      Particle.publish("messageToRoomie", "Hey roomie, I'm home!");
      lastPublishTime = millis();
  }
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

1