Continuous servo stops spinning randomly

Hello, I do a project where I need the continuously rotating servo rotate for some time and then stop. I bought Tower Pro MG90S from eBay and hacked it to move constantly in directions. It works, but when I want it to rotate forever, it stops usually after 1 or 2 seconds. I have no idea why. I test it with this code:

#include <Servo.h>
Servo servo1;
const int servopin = 9;
const int one = 2150;
const int two = 600;

void setup() {
servo1.attach(servopin);
servo1.writeMicroseconds(1500);
}

void loop() {
  servo1.writeMicroseconds(1500);
  delay(1000);
  servo1.writeMicroseconds(one);
  delay(5000);
  servo1.writeMicroseconds(1500);
  delay(1000);
  servo1.writeMicroseconds(two);
  delay(5000);
  
}

It’s very simple just for testing purposes. Do you know what’s wrong?

The code looks o.k. (apart from the weirdness of having variables called one and two that don't contain anything like 1 or 2).

So I'd guess that it's a power problem. How is the servo wired and powered? If it's powered from the Arduino 5V pin try using a separate power supply instead...4 x NiMH AA rechargeables would be ideal but 4 x AA alkalines would also be o.k. for testing.

Steve