Pages: [1]   Go Down
Author Topic: increasing number of servos servo.h can handle  (Read 409 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I didn't see any posts about this, please forgive me if I missed something.  I was curious why the servo.h library is limited to 2 servos on pins 9 and 10.  The description page states:

Quote
This library uses functionality built-in the hardware on pins 9 and 10 of the microcontroller to control the servos without interfering with other code running on the Arduino.

I'm curious what the built-in hardware that allows this functionality.  I know pins 9 10 and are capable of PWM output (which is not appropriate for running servers directly) but so do 3, 5, 6, and 11.  Could servo.h be modified as such, around line 35:

    static uint8_t attached3;
    static uint8_t attached5;
    static uint8_t attached6;
    static uint8_t attached11;

Giving control of 6 servos?

Thanks,
Cory
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 267
dinosaur cork
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It could be done but the timers on the other pins are used for other things. Use the other servo library, it works great and addresses servos on any pins.

The only inconvenient issue about the other library is that it is  named the same thing as the first one. And both should be in the core distribution. There was a rough consensus to change the name of the second library to SoftwareServo - following the SoftwareSerial  example, only no one has done anything about it in more than a few months.

PaulB
« Last Edit: April 10, 2009, 06:21:34 pm by paulb » Logged

Pages: [1]   Go Up
Jump to: