360 Servo control with Blynk

Hello, I am quite new to programming. I would need help programming a 360 degree servo motor. I need it to rotate to the right 10s and stop after clicking V1, and to turn left after pressing V2 and stop after 10s.

I need only the part of the program where it determines the rotation and not the connection.

Thanks for the help.

Have you tried searching the forum?

Pete.

Yes, many times but i didn’t get the right answer.

Adam Križaj

Hey there,
This is a blynk legacy sketch you can try


#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>

#include <Servo.h>



Servo servo;



char auth[] = "Blynk Auth Token";

char ssid[] = "your ssid";

char pass[] = "wifi password";



void setup()

{

  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);



  servo.attach(15); // NodeMCU D8 pin

  

 }

  

void loop()

{

  

  Blynk.run();

  

}

BLYNK_WRITE(V1)

{

   servo.write(param.asInt());

}



BLYNK_WRITE(V2)

{

  servo.write(0);

}

BLYNK_WRITE(V3)

{

  servo.write(90);

}

no, this is not help full.
my servo just rtate in one deraction and do not stop.

can you look in code and corect thet when I press V1 go up for 10s and then stop avtomaticli. And down on V2 for 10s and stop avtomaticli. Or maybe anather button for stop, this will be good too.

Thank for your help

The example is designed to work with a normal servo, you are using a continuous rotation servo so I recommend you to check this

I do not found this helpful

servo.writeMicroseconds()

A continuous rotation servo motor can be controlled by calling the servo.writeMicroseconds() function, which typically accepts values from 1000-2000. A value of 1000 should rotate the motor counter-clockwise at full speed. A value of 2000 should rotate the motor clockwise at full speed. A value of 1500 should cause the motor to stop rotating (and without any vibration). Intermediate values can be used to change the speed of the rotation.

// rotate counter-clockwise full-speed
servo.writeMicroseconds(1000);

// rotation stopped
servo.writeMicroseconds(1500);

// rotate clockwise full-speed
servo.writeMicroseconds(2000);

In the 4 months since your last post in this topic you could have taught yourself to be quite a proficient C++ programmer.

The forum isn’t a code factory, and whilst forum members might give you snippets of code or point you in the right direction, ultimately it is you that will need to take ownership of writing and maintaining your code.

Pete.

1 Like

Thanks for your help.
Now project works but it is too feast how I make servo slowly.

Pete.

If I understen any number between 2000 and 1500 will change hot or so specifically set?

I have no idea what this means.

Pete.