Print
Category: ARDUINO
Hits: 349

As I wrote a sketch for my stepper motor controlled by Blynk, I found the push button caused stepper motor did 2 revolutions for each push.

After searching several times in the webs, I finally found that Blynk push button function in sketch produced 2 revolutions or execute function 2 times because of Blynk function for button detect for PUSH and RELEASE.

To avoid this problem, we need to separate PUSH and RELEASE action in separate condition in sketch.

Below is the example.

BLYNK_WRITE(V5) // V5 is the number of Virtual Pin
{
//int pinValue = param.asInt();
if (param.asInt()) //button pushed
{
feed(1);
} else {
//Do nothing button released
}
}