Currently I am working on an Arduino based project. My project require interfacing 6 servo motors and an SD card module to my Arduino UNO. The problem is that I need all the six PWM pins for six servos (Including pin 10) which happen to be the default Slave Select Pin for SPI communication. I don't want to use software based PWM on a digital pin. I could not find any resource on how to change the default SS pin to any other pin. Any help in this regard will be highly appreciated. Thanks!
Just declare it and use it:
byte ssPin = 7; // or any other pin, stay away from 0,1, leave those for Serial() byte defaultSS = 10; // 53 on a 2560 pinMode (ssPin, OUTPUT); digitalWrite (ssPIN, HIGH); // typical slave select OFF state pinMode (defaultSS, OUTPUT); // 10 MUST be an output for device to be SPI master (328P) SPI.begin(); // default is 4 MHz speed, MSBFIRST // takes care of SCK, MISO, MOSI, don't need define/declare those digitalWrite (ssPin, LOW); SPI.transfer (ledData, 0xAA); // example data going to a device digitalWrite (ssPin, HIGH);