CPP: Servo sg90 - lvidarte/esp8266 GitHub Wiki
The sg90 servo has three wires: brown (gnd), red (vcc), and yellow (signal). The vcc is the power source for the servo, and it has to be connected to the vin pin of our board – this way it is connected directly to the USB port, and not powered through the board.
Checkout this PlatformIO project code here
#include <Arduino.h>
#include <Servo.h>
Servo servo;
void setup ()
{
servo.attach(14);
}
void loop ()
{
// To 0°
servo.write(0);
delay(1000);
// To 90°
servo.write(90);
delay(1000);
// To 180°
servo.write(180);
delay(1000);
}