Back to Parent

//connected LED - 02

int ledPin = D2;

void setup()
{
   pinMode(ledPin, OUTPUT);
   digitalWrite(ledPin, LOW);
   Particle.function("led", ledControl);
}

void loop()
{

}


int ledControl(String command)
{
   int blinkTime = atoi(command);
   {
        for (int i = 0; i < blinkTime; i++)
        {
    	    digitalWrite(ledPin, HIGH);
    	    delay(1000);
    	    digitalWrite(ledPin, LOW);
    	    delay(1000);
        }
        return 1;
   }
   return 0;
}
Click to Expand

Content Rating

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

0