And now I just realized that I posted this question in Particle’s Community instead of Blynk’s Community… SMH
So I know that I need to declare all the virtual LEDs I want to use, like this:
WidgetLED wet1(0);
WidgetLED dry1(1);
WidgetLED wet2(2);
WidgetLED dry2(3);
WidgetLED wet3(4);
WidgetLED dry3(5);
WidgetLED wet4(6);
WidgetLED dry4(7);
But I want to declare them like this:
WidgetLED wet[] = {1, 2, 3, 4};
WidgetLED dry[] = {1, 2, 3, 4};
When I try to turn them .on() or .off() i’m getting errors that I’m not sure how to fix…
All-in-all it looks like this:
int mSensor[] = {1, 2, 3, 4};
WidgetLED wet[] = {1, 2, 3, 4};
WidgetLED dry[] = {1, 2, 3, 4};;
for (int i = 0; i < 4; i++){
int x = analogRead(i);
mSensor[i] = map(x, 0, 4095, 0, 100);
if (mSensor[i] > 50)
{
wet[i].on();
dry[i].off();
}
else
{
wet[i].off();
dry[i].on();
pumpOn();
}
}
But here I run into the problem that wet[i].on() was not declared in this scope… my brain is hurting trying to figure this out.
Hmm… now that I’m typing it out I see that using “WidgetLED wet[] = {1, 2, 3, 4};” creates the 4 virtual LEDs, but doesn’t assign them to a virtual pin… or it doesn’t create them at all… or ugh I don’t know.
Am I making any sense? I could use some pointers…