Run Motor For 5 Seconds

Your help is appreciated!

I have a button set for pin 5. Pin 5 needs to activate a motor for 5 seconds and then stop. A second pin, pin 16, needs to activate at the same time for the same duration of 5 seconds. I already have everything wired physically so I all I need is the code that will enable me to use Blynk.

I am using the iOS version of Blynk!

I posted the code below that I am currently using on my Arduino.

Thanks again,

Daniel Kitchen



#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "1769a0a206b14823b4d61da38ef73e94";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
}

void loop()
{
  Blynk.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}
```cpp

void loop()

Check your pasted code… seems to be cut off.

That is the end of the code Jamin. I don’t have any custom code inserted as of now. Thanks for the reply!

I think I saw some of the directions for the code you are looking for…

Read more about it on the Arduino site and look at the timeout timers in particular.

This is NOT a code factory, nor are we code mechanics… so please don’t ask for custom code… but as you learn, we will assist.

Thanks Gunner. I hated having to ask for help however I’ve been trying for a week now.

This will NOT be drop in code for your purposes, however it makes use of the timeout timers I was referring to…

1 Like

I’ve helped with a similar problem in the past. I’ll try and find it.

Found it …

2 Likes