Back to Parent

// 2.1 Modify the cloud function to blink the LED 3 times after it is called
int ledPin = D3;

void setup() {
   pinMode(ledPin, OUTPUT);

   digitalWrite(ledPin, LOW);
   
   Particle.function("led", ledControl);
}

void loop() {

}

int ledControl(String command)
{
   for (int i=1; i<=3; i++) {
        digitalWrite(ledPin, HIGH);   
        delay(500);               

        digitalWrite(ledPin, LOW);   
        delay(500);  
   }

   return 1;
}
Click to Expand

Content Rating

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

0