I'm trying to programme a servo motor to reach certain positions. I have a 360 degrees servo motor, so I can not use the Servo library and I can only control the speed. Therefore I want to regulate the time for the pulse. The setup is simple, 5 V, GND and pin 9 from the Arduino to the motor.
int servo1 = 9;
void setup{
Serial.begin(9600);
pinMode(servo1, OUTPUT);
}
void loop{
digitalWrite(servo1, HIGH);
delay(5000);
Serial.println(digitalRead(servo1));
digitalWrite(servo1, LOW);
delay(5000);
Serial.println(digitalRead(servo1));
}
Expected: I expect the code to run the servo motor at full speed for 5 seconds.
Actual: The motor runs at the first impulse and pauses for 10 seconds.
How can I improve the code to do what I expect?