Speed of servo with nodemcu

Hello friend.
i have some Problems:

1- actually i dont know what is best place for my code process(project)? how many Methodes? Where can i do insert my code(which section is true)?
When i try to use "for " loop and other code on my code blynk app get delay on send and recieve!

2- How can i set control speed of servo motor on nodemcu servo example without delay on loop.

3- when i do servo nodemcu example, and i set from 0 to 30 degree(big step) my servoo go to a loop(:frowning: ) (like as sweep) what accure this?is it answer that nodemcu crashed?

4- with local server how many process can i do without delay on serve.

Thanks blynk manager.

I don’t understand the first part of your question, but you have to learn how to use BlynkTimer as much as possible instead of delays and long for loops. But you might be able to use some shorter for loops if you also include the Blynk.run(); command in the loop as that will allow Blynk to stay in operation. NOTE: you have to watch out for memory issues.

Generally you do not control the speed of a standard servo without using multiple little steps. Normally you just tell it which position to go to and it does. And use timers instead of delays - here is an example of a servo sweeping back and forth without delays. I have also found that using the attach() detach() commands can keep the servo from twitching when not in motion.

//===== Servo Sweep Switch Function =====
BLYNK_WRITE(V0) // Switch Widget
  SrvoButtonState = param.asInt();
  if (SrvoButtonState == 1) {
    timer.setTimer(800L, Servo1, 1);  // Run Servo1 loop every 800ms
  } else
} // END Blynk Function
void Servo1() {
  timer.setTimer(800L, Servo2, 1);  // Run Servo2 loop every 800ms
void Servo2() {
  Blynk.syncVirtual(V0);  // Check if switch still activated

I believe Blynk’s direct pin control of a servo utilises PWM, and while that will sort of work, it is not as accurate as PPM (as is generated in Servo Library) Try using virtual pins and Servo Library.

BLYNK_WRITE(V1) // Servo Slider Function
  SrvoPos = param.asInt();
  myservo.write(SrvoPos); // myservo needs to be setup for servo library use.
} // END Blynk Function

If you mean how many projects at a time can Local Server run without slowing down… I don’t know, but probably way more than the average Blynk user ever needs. How many are you planning on running, and on what hardware is this server running on?

You have been on this forum for a while now, you should know that most of these questions where already answered, some repeatedly, in other topics… please try to utilise the Search functions, Documents and Help Center resources more. And your best way to learn is keep experimenting with the examples while researching those resources. Thank you.

thanks alot
is it possible power on rassberry pi for long time as a server? or for big project I must to use a mini pc?

Yes Pi’s will run for months, if not years without rebooting. When we set them up we don’t bother with the GUI overhead.

if possible blynk’s app do for example some command together (not at same time but do continuesly) same as run a scenario? for example sleep mode function or party scenario or other config.

blynk is best but for more application i think that need some upgrade and add function that you now better. good luck.