Calling a function once only
hi. don't think need post whole code in nutshell have float switch providing either high or low. whenever changes low high want call pwr1on(), when goes high low want call pwr1off().
i can't figure out way of calling once , not repeatedly.
code: [select]
void pwr1on()
{
digitalwrite(22, high);
pwr1=1;
blynk.virtualwrite(v30, 1);
blynk.virtualwrite(v40, 1);
}
void pwr1off()
{
digitalwrite(22, low);
pwr1=0;
blynk.virtualwrite(v30, 0);
blynk.virtualwrite(v40, 0);
}
void loop()
{
sensorval1 = digitalread(50);
if (sensorval1 == low)
{
pwr1on();
}
else
{
pwr1off();
}
}
i can't figure out way of calling once , not repeatedly.
see ide example digital/statechangedetection.
Arduino Forum > Using Arduino > Programming Questions > Calling a function once only
arduino
Comments
Post a Comment