-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add note about Timers and recommended pins to avoid with additional libraries #15
base: master
Are you sure you want to change the base?
Conversation
…ibraries reference issue pololu#7 some libraries and functions conflict with PWM use, avoiding PWM pins on Timer 1 on the uno or Timer 5,or 2,on the mega - UNO: when you use the Servo Library you can’t use PWM on Pin 9, 10 - MEGA: it is a little bit more difficult - For the first 12 servos timer 5 will be used (losing PWM on Pins 44,45,46) - For 13-24 servos timer 5 and 1 will be used (losing PWM on Pins 11,12,44,45,46) - For 25-36 servos timer 5, 1 and 3 will be used (losing PWM on Pins 2,3,5,11,12,44,45,46) - For 37-48 servos all 16bit timers 5,1,3 and 4 will be used (losing all PWM pins).
@ryantm @kevin-pololu @DavidEGrayson, any thoughts on merging this PR? |
@ryantm any thoughts on merging this PR? or closing? |
@photodude Since we are pretty sure we aren't going to support different timers in the library at this time, I think we should close this. Are you okay with that? |
This isn't so much about supporting different timers, as it is a cautionary note indicating an area where people might run into issues with timer conflicts. I personally ran into this information in trying to use the default servo library with the dual-vnh5019-motor-shield, I had all kinds of problems until I found out about the timer conflicts. |
@ryantm any thoughts on merging this PR? or closing? |
This pull request has a lot of information, so it will be hard to verify all of it hard to keep it updated as the third-party libraries you refer to change over the years. Also, note that this library doesn't just work on AVRs, but also works on a wide variety of Arduino-compatible boards, so we don't want to make blanket statements like "Timer0 is used by millis()". I don't think we should try to document every possible timer and pin conflict that could happen, but if there are one or two particular conflicts that you think actually happened to a real user in the real world and cost them a lot of time when debugging, that would be good to hear about. |
@DavidEGrayson Understood. Maybe the best way to handle this is a shorter cautionary note in the readme file to check timer and pin conflicts with various boards and additional libraries. In my case, it was a conflict between certain pins in the dual-vnh5019-motor-shield, the servo library and the Arduino mega which caused all kinds of issues for our project. My experience is limited to use with Arduino Mega and Uno boards. I think a good cautionary note about potential timer and pin conflicts especially when integrating with additional libraries like the servo library would have been sufficient to have quickly set our team on the right path for identifying the conflicts which broke the code, motor and servo functions. |
Reference issue #7
some libraries and functions conflict with PWM use, avoiding PWM pins on Timer 1 on the uno or Timer 5, or timer 2, on the mega
Some References