Go Down

Topic: Arduino Mega Sensor Shield (Read 945 times) previous topic - next topic

Mach_07

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.

groundFungus

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

vinceherman

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

Mach_07

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

groundFungus

#4
Mar 19, 2018, 04:07 pm Last Edit: Mar 19, 2018, 04:11 pm by groundFungus
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.

Mach_07

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?

vinceherman

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; https://en.wikipedia.org/wiki/Hyperlink

vinceherman

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.  :)

Mach_07

#8
Mar 26, 2018, 12:18 pm Last Edit: Mar 26, 2018, 12:20 pm by Mach_07
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)
#else
#define MAX_SERVOS             12        // this library supports up to 12 on a standard Arduino
#endif

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.

Go Up