Arduino Mega Sensor Shield

I'm using an Arduino Mega Sensor Shield on a Mega 2560 board and so far I have 12 servos attached to it from PWM pins 2 to 13. I want to add 5 more servos but there are no more PWM pins so which pins do I do I use for these.

Servos do not need PWM pins. Any digital pin can be used with the Servo library.

Do you have a link to your shield?
Some allow more than others.
Some are I2C and can easily include multiple boards.

I've tried Servo.h library but this conflicts with MegaServo.h.
The Mega Sensor Shield does not allow addition shields on top.

vinceherman asked for a link to the shield that you are using, I think we need to know that. The MegaServo library is not limiting to 12 servos so the hardware must be the limiter. There is probably a solution, but until we know exactly what you have it is hard to offer one.

I've managed to put the 12 servos onto digital pins from 22 to 33 and they are working perfectly well. But will not work from pin 34 onwards. This means the Arduino Mega Sensor Shield IS limiting me to 12 servos. What do you mean by a link?

What do you mean by a link?

A Hyperlink to the web page that lists the technical data about the specific shield you have.
It looks like this; Hyperlink - Wikipedia

This means the Arduino Mega Sensor Shield IS limiting me to 12 servos.

I do not know this to be true. It might be. But it will be much easier to determine if you can provide us with that link. :slight_smile:

I think this may be the problem. Here’s an extract from the MegaServo.h library I’m using:

#if defined(AVR_ATmega1280)
#define MAX_SERVOS 48 // the maximum number of servos (valid range is from 1 to 48)
#define MAX_SERVOS 12 // this library supports up to 12 on a standard Arduino

This is presuming you are using a Mega 1280 board but I’m using a Mega 2560 board.

I’ve tried changing (AVR_ATmega1280) to (AVR_ATmega2560) but this does’t work.
I’ve also tried changing 12 to 24 and even tried changing 48 to 24 but it stills only allows up to 12 servos.