Connect HC-05 and NRF24L01

Hi! I'm marta and I want to connect bluetooth module HC-05 and NRF24L01 at the same time. HC-05 code works but when I write the NRF's code in the HC's code it doesn´t work, can you help me?
the code is:

#include <SoftwareSerial.h> //Librería que permite establecer comunicación serie en otros pins
#include <nRF24L01.h>
#include <printf.h>
#include <SPI.h>
#include <RF24.h>
#include <RF24_config.h>
//Aquí conectamos los pins RXD,TDX del módulo Bluetooth.
SoftwareSerial BT(10,11); //10 RX, 11 TX.
#define CE_PIN 8
#define CSN_PIN 7

RF24 radio(CE_PIN, CSN_PIN); 
// Se declara el canal (64 bits en hexadecimal) para transmisión RF
const uint64_t canal = 0xE8E8F0F0E1LL;
#define CONTROL  13 //tenemos 13 controles luz, seguridad, persianas, humo, puerta y los modos automático/manual, abrir/cerrar, activar/desactivar, subir/bajar/parar
  char val;
  unsigned int estado[CONTROL]; //ponemos control 4 porque va del 0 al 4 y eso hace un total de 5
int recibido;
int A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S;

void setup()

void loop()

  if(BT.available())    // Si llega un dato por el puerto BT se envía al monitor serial
    Serial.write("Hola mundi");
  if(Serial.available())  // Si llega un dato por el monitor serial se envía al puerto BT

    BT.write(;//luego descomentar
    val =;
      if( val == '1' )
    digitalWrite(7, HIGH);
    //hacia bajo es lo nuevo Creo que es esto lo que funciona.
    if( Serial.available() ) {
val =;


You are using an SPI pin for the SoftwareSerial, you will have to use a different pin for the 11.

I was assuming a 328p processor like in the UNO or Nano classic.
This MCU uses 11,12,13 for the SPI interface.
10 is the standard CS, but it is not a fixed pin.

You assumed well, I have the UNO processor. Thanks you! It was the problem, I have changed it to pin 5 and 6 but now the problem is that the serial doesn´t read correctly. The character that i send is for example "A" and it reads as "?"

I have no expertise in using SoftwareSerial and your HC-5, sorry.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.