Hello Arduino Forum!
I am back and I have a question regarding how to use the SPI interface to use two different modules that both require the MOSI, MISO, SS, and SCK pins of the Arduino Mega.
If there is an easier way to do this or some library out there that simply changes the pin layouts of these modules, I would GREATLY appreciate a link. Even to a crash course on using the SPI slave select functionality would be amazing!
On to the project,
Currently I am designed a device using a Mega2560 that at its core will read a RFID tag ( using the RC522 module, which may or may not be replaced later with a stronger reader ) and transmit that data to an Arduino Uno using a pair of Nrf24L01+ High Powered radio antennas.
The Mega arduino has many other included modules ( Such as a RTC, LCD Display, some LEDS here and there and a Piezo Buzzer ), so I do not believe I can simplify this project by just picking up a shield and just using the RC522 reader, all the modules are required and the Mega's expansive pin board is needed.
The issue I am running into is that every library I have come across requires the RC522 reader and Nrf24L01+ Transmitter to independently utilize pins 50-53 ( the SPI interface as I understand it ). My first approach to this problem was to simply "split" the pins in a sense by wiring the components to a breadboard with pin 50 for example go to both the RFID reader and the Radio, but as you can guess I have not had much success with this approach.
Doing further research, I come across this:
To my understanding, you can wire these components to any pin as long as they are defined and the code effectively only runs one of the modules at a time, using the SS ( slave select ) pin to power up and down the respecting module needed.
I am a little concerned that this is out of my depth and am looking for any clear examples to further m knowledge on:
A) how to setup the modules on any pin so that both modules can be used on the same Mega
B) a small example code on what it would be like to "selecting" these devices as the code is run
This forum has already provided excellent insight on helping me getting the Radio Module setup and anymore advice would be greatly appreciated! I am highly enjoying learning how to code these microprocessors and am looking forward to working on a solution.