This may be another code error on my part but… When I include:
Particle.function( "LED_control", LED_control);
and
Blynk.begin(auth);
in the void setup()
together,
It causes the “D3” command in the code below to be skipped:
int LED_control(String command)
{
for (int i = 0; i < 5; i++)
{
digitalWrite(D6, HIGH); // flash the WHITE LED
delay(200); // wait xx ms
digitalWrite(D6, LOW); // turn off LED
delay(100);
}
for (int i = 0; i < 15; i++)
{
digitalWrite(D7, HIGH); // flash the on-board LED
delay(30); // wait xx ms
digitalWrite(D7, LOW); // turn off LED
delay(100);
}
for (int i = 0; i < 25; i++)
{
digitalWrite(D3, HIGH); //Flash the RED RGB LED "D3"
delay(30);
digitalWrite(D3, LOW);
delay(100);
}
When I delete the Blynk.begin(auth) from setup, the code works every time. And obviously won’t talk to Blynk.
I also tried to change the order in the setup, no change in the issue.
Of course, when Blynk.begin(auth) is in the setup, Blynk works perfectly. But the D3 routine is skipped.
I want this to work with the particle cloud and be seen and controlled with Blynk.
It all compiles without errors with or without Blynk.begin(auth) in the code.
Here is the complete setup() code:
void setup()
{
Particle.function( "LED_control", LED_control); // create a cloud function ("LED_control")
pinMode(D0, OUTPUT); // BLUE LED
pinMode(D1, OUTPUT); // GREEN LED
pinMode(D3, OUTPUT); // RED LED
pinMode(D7, OUTPUT); // On Board BLUE LED
pinMode(D6, OUTPUT); // WHITE LED
pinMode(btnPin, INPUT_PULLUP); // Setup physical button pin (active low)
timer.setInterval(1000L, buttonLedWidget);
Blynk.begin(auth);
}
Any help is appreciated.