I am making a robotic project to control my robot with logitech extreme 3d pro joystick ( it has a wire ) with nrf24 wireless communication. I managed to use and work successfully with my joystick and nrf24 separately. After that I decided to combine them but They are not working at the same time because thy share the same SPI ( I learned it after long tries and failures, I was opened this thread before: Arduino Mega + nrf24L01 doesn't communicate, need your help, thank you - Project Guidance - Arduino Forum ).
I checked internet so much and I cannot find a solid tutorial that shows everything step by step for what kind of changes do we need to make to use NRF24 and Arduino USB Host Shield at the same time at Arduino.
If it is possible and if you know how to do it, would you help me please ?
Note:
I found a thread here: GitHub - greiman/DigitalIO: Fast Digital I/O, Software I2C, and Software SPI for AVR Arduino but I didn't understand most of parts. Shortly, it says this:
Install the digitalIO library
Reinstall the RF24 library from Updates
Open RF24_config.h in a text editor. Uncomment the line #define SOFTSPI
In your sketch, add #include DigitalIO.h
Note: Pins are listed as follows and can be modified in the RF24_config.h fileThis is for Arduino Mega with latest version of nrf24 library: RF24 - Arduino Libraries
const uint8_t SOFT_SPI_MISO_PIN = 16;
const uint8_t SOFT_SPI_MOSI_PIN = 15;
const uint8_t SOFT_SPI_SCK_PIN = 14;An other nRF24L01 Library for Arduino & Raspberry Pi/Linux Devices ( for Arduino UNO ): GitHub - nRF24/RF24: OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
#define SOFT_SPI_MISO_PIN 9
#endif
#ifndef SOFT_SPI_MOSI_PIN
#define SOFT_SPI_MOSI_PIN 8
#endif
#ifndef SOFT_SPI_SCK_PIN
#define SOFT_SPI_SCK_PIN 7
But there is conflict here really. Look at this screenshot please and it says which pins we need for nrf24 communication with arduino.
So the pins we see in these screenshots are not the pins are defined in the quote I gave from the RF24_config.h itself already. However, as tmrh20 is saying us here too https://tmrh20.github.io/RF24/Arduino.html
https://tmrh20.github.io/RF24/Arduino.html
Alternate SPI Support
RF24 supports alternate SPI methods, in case the standard hardware SPI pins are otherwise unavailable.
Software Driven SPI
Software driven SPI is provided by the DigitalIO library
Setup:
Install the digitalIO library
Open RF24_config.h in a text editor. Uncomment the line #define SOFTSPI
In your sketch, add #include DigitalIO.h
Note
Note: Pins are listed as follows and can be modified by editing the RF24_config.h file
const uint8_t SOFT_SPI_MISO_PIN = 16;
const uint8_t SOFT_SPI_MOSI_PIN = 15;
const uint8_t SOFT_SPI_SCK_PIN = 14;
I might seem like I am repeating but I tried to explain myself. It is so confusing. When I change/assign the SOFT_SPI pins to different pins then nrf24 doesn't start/work.
I don't have a deep knowledge about this issue so I don't know how to fix this problem. If I cannot solve this then I need to find an other wireless device ( start doing from zero again with a different device and then I might come and ask many questions again^^ ). I will be happy if someone would help me, I cannot go further with my robotic project right now because of it. If you explain me everything step by step I will be very happy ( for example, which which nrf24 library I need to solve this problem, and what parts do I need to change in the cpp, h files and in my arduino sketch; what kind of changes do I need to make for arduino usb host shield part too etc. ) ? I look forward your replies to me. See you, that's all.