I have an SPI interface with my Raspberry Pi that currently uses up pins 10 through 13. I am aware that using the Arduino servo library disables PWM on pins 9 and 10 and servotimer2 disables PWM on pins 3 and 11.
Without changing hardware, is it possible to change the library to disable pins 10 and 11 instead?
I don't need 10 for SPI since I have only one device, I can just use 11 and 13 for MOSI and SCLK? I dont need 12 because my Arduino never communicates back to the Pi.
That allows me to use 3/5 for my sonars and 9/10 for my motors. This should theoretically work?
I've been using the Arduino as the SPI slave, the RPi as the SPI master because it is the one sending commands. I'm assuming that once you set 10 to OUTPUT you can't use it as a slave anymore?
cmccrave:
I've been using the Arduino as the SPI slave, the RPi as the SPI master because it is the one sending commands. I'm assuming that once you set 10 to OUTPUT you can't use it as a slave anymore?
I think that that is a valid assumption. That might be a problem. You could use a Mega, which has SPI on different pins.
I don't know what happens if you set pin 10 as INPUT, then initialize SPI, and then set pin 10 as OUTPUT. Be worth performing a test.
cmccrave:
I've been using the Arduino as the SPI slave, the RPi as the SPI master because it is the one sending commands. I'm assuming that once you set 10 to OUTPUT you can't use it as a slave anymore?
Ahhh! Yes. If your Uno is an SPI slave then 10 must be an input and it must be the CS function.
You could try a Micro or Leonardo. They have a slightly different mix of capabilities on their pins. A Teensy can do PWM on all pins and it can use alternate pins for SPI. A Mega or Due has a lot more pins, so you have a lot more choice for outputs.