Hello!
Did you ever manage to record and broadcast in the same sketch using TMRPCM ? I m not being able to do so... As soon as enable recoding in TMRpcm.h, it stops compiling right away... I believe there are some shared resources between pcmConfig.h and TMRpcm.h ... The code I m trying to make is attached. I also have enabled #define ENABLE_RF in library... Thanks in advance.
#include <SD.h> // need to include the SD library
#define SD_ChipSelectPin 4 //example uses hardware SS pin 53 on Mega2560
#include <TMRpcm.h> // also need to include this library...
#include <SPI.h>
#include <RF24.h>
#include "printf.h"
RF24 radio(7, 8); // I use 48,49 on Mega 2560, 7,8 on Uno, Nano, etc
TMRpcm audio;
pcmRF rfAudio(radio);
void setup() {
audio.speakerPin = 9; // Use pin 9 on 328 boards (Uno, etc)
pinMode(10, OUTPUT); // Pin 10 on 328 boards (Uno, etc)
Serial.begin(115200);
if (!SD.begin(SD_ChipSelectPin)) { // see if the card is present and can be initialized:
Serial.println("SD fail");
return; // don't do anything more if not
} else {
Serial.println("SD ok");
}
printf_begin(); // Comment this out to save spacecaaa
rfAudio.begin();
radio.setPALevel(RF24_PA_MIN);
radio.setDataRate(RF24_250KBPS);
radio.printDetails(); // Comment this out to save space
audio.CSPin = SD_ChipSelectPin;
}
void loop() {
if (Serial.available()) {
switch (Serial.read()) {
case 'a': audio.startRecording("avi.wav", 16000, A0, 1); break;
case 'b': audio.stopRecording("avi.wav"); break;
case 'c': audio.stopPlayback(); rfAudio.play("avi.wav", 0); break; // Play to radio # 1 in the radio group
case '1': rfAudio.broadcast(1); break; // Broadcast the current audio to a different radio/group
case '2': rfAudio.broadcast(2); break; // Broadcast the current audio to a different radio/group
case '3': rfAudio.broadcast(255); break; // Broadcast the current audio to a different radio/group
case 's': rfAudio.stop(); break; // Stop radio playback
case 'S': audio.stopPlayback(); break; // Stop local playback
case '=': audio.volume(1); break; // Volume up
case '-': audio.volume(0); break; // Volume down
default: break;
}
}
}