Code issue or power issue?

So my code is not running. Idk if its just a power issue or not because I’m using the USB to connect my Arduino Uno to my laptop. I don’t have any batteries on me at the moment.

However, the objective of the code attached is for both servos to run until the ultrasonic sensor senses an object 5cm away and then both servos will stop.

I have only one servoR running because I’m trying to test to see if the code will work for one and then I have servoL commented out.

As of right now, the servo moves maybe .5 of a degree and then doesn’t move at all unless I reset the board.

Is there anything wrong with my code or is it simply a power issue?


Always use a separate power supply for servos, and connect the grounds.