//connected LED - 01
int ledPin = D2;
void setup()
{
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
//Register our Particle function here
Particle.function("led", ledControl);
}
void loop()
{
}
int ledControl(String command)
{
if(command.toLowerCase() == "blink")
{
for (int i = 0; i < 3; 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!
You must login before you can post a comment. .