So I have a motor driver shield, this one: Motor Shield V2.0 | Seeed Studio Wiki
I am using an UNO.
My issue with it is that it uses digital pins 8-13. This interferes with the SPI pins, which are 10-13.
Thus, I would like to remap the board to use different pins. There seems to be a problem though:
To control the motor's speeds, the shield uses the PWM pins 9 and 10. I looked in the .cpp files for the library, and it uses TIMER1, which is what is controls these PWM pins.
If I plan on making this shield able to control motor speeds with PWM after changing my pins, I would have to use either TIMER0 (pins 5 and 6) or TIMER2 (pins 11 and 3). However, these are both 8-bit timers. Also, I can't use TIMER0 as it is used for the delay() functino, and TIMER2 is attached to pin 11 (which I want for SPI).
Does anyone have any advice on what I could do?
I haven't messed with timers or interrupts before, so I am not sure if I could re-write the library well for myself.
Perhaps I could use pins 3 (TIMER2) and 9 (TIMER1). However, TIMER2 is only 8 bit (if this is a problem)
Thanks in advance for the help.
Yes, you can do what you want to do. Here's some details:
First of all, you'll need to handle physically remapping the wires (if you already know how to do this, just ignore this part). The easiest approach for that is probably Sparkfun's Go-Between Shield. If you don't want to do that, you'll have to resort to cutting traces and greenwiring.
Next is the timers. If you're using SPI just as a master, then you can use whatever pin you want for SS, so it doesn't matter that pin 10 is used, and you can leave them exactly as they are. If you do need SS, you have a couple of choices. One is to use OC1A and OC2B, as you mentioned. The drawbacks to this approach are that you now don't have any free timers should you need them for anything else, and the required modifications to the library will be slightly more extensive since you'll be using two timers instead of just one, but you keep Arduino's delay function. Your other option is to use OC0A and OC0B. This has the drawback of breaking the delay function (and related ones), but it's much simpler to do, and you can still use AVR libc's _delay_ms or _delay_us if you need a delay.
The other pins are trivial to remap (just changing the numbers in the header file). Also, this library doesn't use interrupts at all, so you don't have to worry about them.