using analog pins on a uno to move a servo

high, i'm working on a hexapod(18 servo's) it all works sweet on a mega, but i want to make it work with a uno. is there anyway i can use all the digital and analog pins at same time to run the servo's using servo.h library or is it a hardware issue.i have tried it but no matter what i do i can't get analog pins to work same time as digital.i know it says on datasheet it'll only run 12 servo's but i've seen people write their own library's and get 18, but that's a bit above my grade.

Hardware issue. Servo outputs are created from PWM channels. Mega has more than Uno, hence can support more servos.

– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes – One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode – Real Time Counter with Separate Oscillator – Six PWM Channels

vs – Two 8-bit Timer/Counters with Separate Prescaler and Compare Mode – Four 16-bit Timer/Counter with Separate Prescaler, Compare- and Capture Mode – Real Time Counter with Separate Oscillator – Four 8-bit PWM Channels – Six/Twelve PWM Channels with Programmable Resolution from 2 to 16 Bits (ATmega1281/2561, ATmega640/1280/2560)

I'd normally suggest an upgrade to an intermediate processor, Atmega1284P, but it has the same PWM complement as the '328P, so that doesn't help.

So - roll your own using blink without delay style programming to fake some more outputs, or stick with a Mega.

jaymiejames: high, i'm working on a hexapod(18 servo's) it all works sweet on a mega, but i want to make it work with a uno. is there anyway i can use all the digital and analog pins at same time to run the servo's using servo.h library or is it a hardware issue.i have tried it but no matter what i do i can't get analog pins to work same time as digital.i know it says on datasheet it'll only run 12 servo's but i've seen people write their own library's and get 18, but that's a bit above my grade.

Adapting the existing Servo library to more channels isn't, I think, too tricky - it may even be as easy as changing one constant in the source. You will get a slower update rate per servo as a result of course...

If someone else has already adapted the library to 18 channels then you don't have to!