Processing for Arduino GPIO pins

Hey guys i was wondering how to code to the GPIO pins on my arduino mega specifically pins 22-50. Im using servo write on my other pins but was wondering the what the code is to get my servos to run off the gpio pins but the same code wont run the servos from the GPIO pins. Any suggestions would be great!!

Servos use PWM to control them. (a signal made of pulses of highs and lows). This is provided at hardware level on the analog pins. But not on pins 22-50. You could implement the same thing by manually writing HIGH and LOW to them on a timed basis but I don't know of any way to get the Servo Library to accept any manual method you devise.

You could, abandon the servo library altogether for these servos, this would involve calculating the duty cycle for the angle you want to send then carry out your virtual pwm accordingly. It really depends how deep is your need and how much of a learning curve you are willing to accept.

It's quite possible someone else has already gone through the pain for you and may have produced a library just for this very job.

Whilst it is true that servos use PWM to control them, the servo library is not limited to using Arduino analogue pins. In fact using them to control a servo would be rather unusual in my experience.

I don't have a Mega and know little or nothing about it, but I am surprised to hear that the servo library does not support the use of pins 22-50. What happens when you try to use them ?

Please feel free to bring me up to speed on the use of a Mega in relation to pins 22-50

Indrick:
Im using servo write on my other pins

How many servos do you want to use with your Mega?

...R