Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more bits to store pin number. Enables servo support on A10-A15 on Arduino Mega. #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aftersomemath
Copy link

@aftersomemath aftersomemath commented Oct 29, 2017

Servo.h currently uses 6 bits to store the pin number attached to a servo. On the Arduino Mega 2560 pins A10-A15 are mapped to 64-69. If a user attempts to attach a Servo object to these pins the 7th bit is truncated. This results pins A10-A15 (64-69) to be silently remapped to pins 0-5. The Servo library will then attempt to pulse pins 0-5 instead of 64-69.

The proposed solution is to use 7 bits to store the pin number instead of 6.

@aftersomemath aftersomemath changed the title Use more bits to store pin number. Enables servo support on A10-A15 on Mega. Use more bits to store pin number. Enables servo support on A10-A15 on Arduino Mega. Oct 29, 2017
@aftersomemath
Copy link
Author

@cmaglie Could you please review?

@nbah22
Copy link

nbah22 commented Mar 3, 2020

Just adding some keywords for people who will search for this issue in future, as I have spent several hours figuring out the solution myself, and google did not help:
Arduino Mega servo library not working pin A10 A11 A12 A13 A14 A15

@sebromero
Copy link
Contributor

@per1234 Do you think this is can be merged?

@aftersomemath
Copy link
Author

@per1234 is there anything I can do to help get this merged or resolved? I'd be happy to test again since it has been a few years.

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants