RF24Audio / basic compile question

Hi,

I try to use the RF24Audio library.
The hardware (wiring; input on A0 on the 1st board; output on a speaker on the 2nd board) works, even the transmission if I use the basic setup/code. Therefore I think that I have basic compile problem.

However, if I try to change the default values (e.g. SAMPLE_RATE) in the userConfig.h, it does not work. I mean that the hardware work still with the default settings, not with my custom settings. I tried to copy that file into my current directory (I added the file in the arduino IDE). I use linux and downloaded the RF24 and RF24Audio libraries from http://tmrh20.github.io

I would like to change the defaults, since the quality is pretty bad.

I also would be happy to understand, why both of the wires of the speaker are connected to PWM outputs, and not one of the wires to the GND. http://tmrh20.github.io/RF24Audio/Setup.html

Thank for your help and suggestion,
Tamas

We need to see your actual code. We need to see some proof that "it doesn't work".

Hi,

I can not decide what's going on. If I could have set the RF_SPEED or not... Please see the output below, especially that of radio.getDataRate()

With this code I get the output below:

#include <RF24.h>
#include <SPI.h>

#include "printf.h"

RF24 radio(7,8);

void setup() {	
  Serial.begin(9600);
  printf_begin();
  
  radio.begin();
  
  if(radio.setDataRate(RF24_2MBPS)) {
    printf("set\n\r");
  }
  else {
    printf("not set\n\r");
  };
  
  radio.printDetails();
  printf("Rate: %i\n\r", radio.getDataRate());
  
}

void loop() {}

set

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0x544d52687c 0xabcdabcd71
RX_ADDR_P2-5 = 0x3c 0xc4 0xc5 0xc6
TX_ADDR = 0x544d52687c
RX_PW_P0-6 = 0x20 0x20 0x20 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x07
RF_CH = 0x4c
RF_SETUP = 0x0f
CONFIG = 0x0e
DYNPD/FEATURE = 0x00 0x00
Data Rate = 2MBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_MAX
Rate: 1

When setting in the RF24Audio/userConfig.h
#define RF_SPEED RF24_2MBPS and run the following program I get the output below:

#include <RF24.h>
#include <RF24Audio.h>
#include <SPI.h>

#include "printf.h"

RF24 radio(7,8);
RF24Audio rfAudio(radio,1);

void setup() {	
  Serial.begin(9600);
  printf_begin();
  
  radio.begin();
  rfAudio.begin();
  
  radio.printDetails();
  printf("Rate: %i\n\r", radio.getDataRate());
  
}

void loop() {}

STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xabcdabcd71 0x544d52687c
RX_ADDR_P2-5 = 0x3c 0xc4 0xc5 0xc6
TX_ADDR = 0xabcdabcd71
RX_PW_P0-6 = 0x20 0x20 0x20 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x06
RF_CH = 0x01
RF_SETUP = 0x0f
CONFIG = 0x0b
DYNPD/FEATURE = 0x00 0x00
Data Rate = 2MBPS
Model = nRF24L01+
CRC Length = 8 bits
PA Power = PA_MAX
Rate: 0

Thanks for your help.

I think that I could change the datarate. If I program one unit to 1MPBS and the other 2MBPS then no communication between the two units. So somehow the radio.getDataRate() may get back with a wrong value (bug?).