-
Notifications
You must be signed in to change notification settings - Fork 73
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
Why Timer4 only for Arduino Mega2560? #50
Comments
The first user requesting AtMega2560 support has opted for Timer 4, so it was done. No other reason. Have you tried this from the README to change the timer ? Similar to ATmega328, but instead of timer 1, timer 4 is used. For users of platformio, the used timer can be changed to either 1, 3, 4 or 5. For e.g. timer module 3 add to platformio.ini under build_flags:
or better:
For arduino users, the same can be done by defining the flag before including the
|
If that does not work, then you need to put the library in your project and change the define in AVRStepperPins.h line 27 to: I haven’t tried it myself, because I use platformio, where it works reliably. |
Yes, I've tried #define FAS_TIMER_MODULE 5 before #include <FastAccelStepper.h>, and it does not work. I'll try to change AVRStepperPins.h, but I bet result will be the same, because there is ifndef. I think that the reason might be in ISR declaration in avr.io, which goes before any custom libraries, but this is just guess. |
I can't believe, but change define in AVRStepperPins.h really works. But when I add define before include lib it does not work. Why??? |
Good that this works. If you find a way, how to get this compiler define done via the ArduinoIDE, then I would happily use that. Cause I have no idea. Personally I would advise to use platformio, where it can be done easily. Pity is, that for any library update, you need to fiddle around with the code again. Sorry for that. |
Add define After include. |
Kind of joke? |
No joke. The last define will take effect, if you define before include, it will be redefined in the include. |
Apparently there is no solution besides changing the code. |
Hi! It is clearly stated in doc that for Arduino Mega2560 we can use only pins 6,7,8 (Timer4). But what is the reason? Can it be improved? In my project I have connected lcd display on mega2560, and these pins are used for display. I want to switch to Timer5 (pins 44,45,46), but it does not work :(
The text was updated successfully, but these errors were encountered: