problem using nrf24l01 and sd card with arduino.

getting problem while using NRF24l01 and sd card module simultaneously. if vcc not given to sd card module then only nrf sensor works. but i want both at a time.

pin connection

nrf24l01:-

CSN = 8
CE = 7
MOSI = 11
MISO = 12
SCK = 13

SD Card:-

CS = 4
SCK = 13
MOSI = 11
MISO = 12

what change should i do ?? for use nrf and sd card simultaneously.

code

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <SD.h>
#include "SD.h"
#include "TMRpcm.h"
#include "SPI.h"

TMRpcm tmrpcm;

#define CE_PIN 7 // for nRF24
#define CSN_PIN 8 // for nRF24

#define csPin 10 // for SDCard
const byte address[6] = "00001";
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
int i;
#define sd_pin 4

void setup() {
Serial.begin(9600);
tmrpcm.speakerPin = 9;
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();

}

void loop() {

if (radio.available()) {
int text[1] = { };
radio.read(&text, sizeof(text));

for (i=0;i<1;i++)
if ((text*)== 172){*

_ Serial.println(text*);_
aud ();
delay(1000);
_
}_
_
}}*_
void aud (){

* SD.begin(csPin);*
tmrpcm.setVolume(5);
tmrpcm.play("3.wav");
delay(1000);
}
hod.ino (838 Bytes)

rahulbirwadkar:
what change should i do ?? for use nrf and sd card simultaneously.

Use a SD card that allows usage of the SPI bus when it is not selected.
Some common SD moules don't tristate MISO.

I think the SD.begin(...) function needs to go in the setup. You're initializing it every time you call the aud() function and the SD card generally doesn't like that.