LED Widget

Hello Everyone,

I tried using this example but keep getting an error.

// Select your pin with physical button
const int btnPin = 7;

WidgetLED led3(V3);

SimpleTimer timer;

// V3 LED Widget represents the physical button state
boolean btnState = false;
void buttonLedWidget()
{
// Read button
boolean isPressed = (digitalRead(btnPin) == LOW);

// If state has changed…
if (isPressed != btnState) {
if (isPressed) {
led3.on();
} else {
led3.off();
}
btnState = isPressed;
}
}

void setup()
{
// Setup physical button pin (active low)
pinMode(btnPin, INPUT_PULLUP);

timer.setInterval(500L, buttonLedWidget);
}

void loop()
{
Blynk.run();
timer.run();
}

please edit your post, and format the code:

1 Like

@imrdnck SimpleTimer library is made for Arduino, and while WiringPi is C++ like, it is not Arduino. You can always ask over on the >wiringPi site< if he has a solution, otherwise you will have to come up with an alternative timing option like millis(). Try testing your wiringPi options based on these instructions:

1 Like

I got it guys it is all coming together now, I was over thinking it as i normally do lol… Thank you both very much.