I need help … I would like that when pressing a push I would switch on a relay for a few seconds
This must be implemented on the device side.
I don’t understand … I have the code to switch the switch on and off, but what I really wanted was to use the push button function to switch the relay on for a few seconds
BLYNK_WRITE(V7)
{
if(param.asInt())
{
//rele On
delay(5000); //5sec
//rele off
Blynk.virtualWrite(V7,LOW);
}
}
Button mode switch.
The button is in the off position.
Most likely due to the delay, the microcontroller will be offline for some time.
You shouldn’t use delays like this with Blynk. BlynkTimer in timeout mode, as a lambda function, is a far better solution.
Pete.
could you send me an example of the code?
Use the magnifying glass icon at the top of the screen to search the forum.
Pete.
pin v7 corresponds to which pin in the node
Search Lambda timer.
This is a virtual pin.
V7 for example.
The real pin is up to you
Use
digitalWrite(1, HIGH);
//ON D1
digitalWrite(1, LOW);
//OFF D1
//also in setup
pinMode(1, OUTPUT);
it’s not working very well, it turns on and off on the app when I’m pressing on the app … I wanted to turn on the relay and it stay on for a few seconds and turn off by itself after that time
You should share your code (correctly formatted with triple backticks) along with details of how you’ve configured your app and how you have wired the physical LED.
Pete.