How to delay the Servomotor Blynk2.0?

first of all you must read this

@eng.abdulrahman134 please edit your post, using the pencil icon at the bottom, and remove the block quotes that you’ve used to format your code and put triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:


    // here we want from you do the change please____
       digitalWrite(LED_G, HIGH);
     tone(BUZZER, 500);
for (angle =0 ; angle <180; angle +=10)
   myservo.write(angle); //servo start position
   delay(150); //speed time to open

   for(angle = 180; angle>=0; angle -=10)
    delay(150); // speed time to close
    digitalWrite(LED_G, LOW);
//until here

when Blynk is connect i want delay the servo 0 to 180 and delay for 7sec and gose from 180 to 0

like this?

I’m curious about why, when I ask you to edit your existing post - using the pencil icon, you choose to ignore that request and post your code again, leaving the unformatted code in your original post.

Can you explain to me why you did that?


sorry i dont understand you

sir like this you want?

You posted your sketch in post #5, but you used blockquotes instead of triple backticks.

I asked you to edit post #5 and fix the formatting of the code. Instead you posted the code again in post #8, so I had to go back and remove your blockquoted code from post #5

I was curious why you didn’t do what I asked…

and instead created extra work for me.


1 Like

oh , now I understanding you sorry about it
I’m new again sorry

@eng.abdulrahman134 please keep your issue in one place, and avoid posting in other people’s topics.

You’ve posted questions about replacing delays with timers in two other topics, when I’ve already provided you with a link to a tutorial on how to do that.

Please don’t spam the forum in this way. If you continue your forum account will be suspended.

If you want to get this working, you will need to improve your C++ programming skills so I suggest that’s where you begin.


I didn’t know that forum systems are like that
My project has a month left to deliver and I am nervous because it is ready. I only have this problem

Thank you all

Okay, use timeout timer instead of delay.
Like this

timer.setTimeout(7000L, []()

So you want other people to write your code for you, so that you can pass it off as your own work?

Your biggest problem - from a Blynk point of view at least - is your void loop. It’s far too cluttered to work reliably with Blynk, and you haven’t taken on board the feedback from John about restructuring your code to fix that.

Also, as you are using the Edgent sketch, I’m fairly sure that you will have some pin conflicts between these:

and the pins used for the Edgent functionality in your Settings.h file. Read this for more info…


Yes, I used it and it was showing me an error in the code
I used a library
#include <SimpleTimer.h>

I think I have a problem when I call the library in
Void loop()

You’re using simple timer not blynk timer.
Read the article in post number 2

You can post the whole sketch after including the timer so we can take a look at it.

ok i will try and tell you .

thank you now my servo delay becuse of you and Mr.Pete
my wrong i was use
#include <SimpleTimer.h>

i should use
BlynkTimer timer;

first i put
BlynkTimer timer;
under the
#include "BlynkEdgent.h"

like this :

#include "BlynkEdgent.h"
BlynkTimer timer;

then i write this to delay the servo:

   timer.setTimeout(10000L, [](){     //to delay the servo for 10sec
      myservo.write(0);  //the servo goes to angle 0

I have another question, can I make the servo unstable when no signal is given to it?
For example, when it is in a state of sleep, can it be moved manually?

Do you mean servo.detach() function ?

Yes i was try it now and i will tell you if it’s work with me
thanks bro👍🏻

1 Like