Servo won't respond with ultrasonic sensor

Could be both. But the vast majority of servo problems posted here are power related so I suggest that you fix that first.

Alright sounds good I'll play with power and see if that helps

And a warning. Do not make the mistake of attempting to use "Vin" or the "barrel jack" in any manner to power the system.

The Arduino requires a regulated 5 V to operate, and the servos require at least that, allowing for at least one Amp per servo as a "stall" rating.

Ok, I've been using the 5V the whole time. I'm just worried if it's my code or not.

Where is the power for your servos coming from? The motor shield has a separate power input so you can provide power that doesn't come from the Arduino, which is handy, because generally, it can't supply enough.

Not according to what you said in #18. USB is very limited.

As Bill explains in #21. Probably power and code.

Powers from my motor shield

Where does it get its power from?

USB that connects to my computer and Arduino

Hobby servos pull a lot of current. Rule of thumb is to allow 1A each, more for big ones. USB from your computer is capped at 500mA. If a single servo is small and unloaded, you may get away with moving it around, but it will be marginal.

Your shield has a place to plug in separate power for servos/motors. I think I see in your picture that it's got a power wire plugged into it. That should be attached to something like a pack of AA batteries that can provide 6V and decent current.

Great so I need to change my battery pack to double AAs and do I need to change my coding in any way?

I have no idea. Fix the power first - as I said before, it's the primary culprit in servo related issues. There's little point trying to debug the code until that is fixed. What is the current battery pack?

Current battery is a 9V

Ah. Case closed I suspect :open_mouth:

Haha, I guess I'm changing batteries. Now all I need to know if my code needs fixing or not.

This is how I would like to set my servos

So, I guess the answer to my post #4 a couple days ago is definitely NO...

I suppose now all I need to know is will my code needs fixing or not and I know I've been really on about my code over all things but I really want this robot to work.

So we just keep going in circles. :astonished:

Bearing in mind my strict warning in #23, to what is this battery connected? :roll_eyes:

Does seem this way.