So I'm making a recording device hooked up to a rotary phone receiver, it is using the TMRpcm Library. Currently, the code I have is working perfectly with my build. The only problem is I want to be able to record an infinite amount of sound files. I had it with a Switch Case earlier but needed to manually name each file and could only reach a case limit of 10 before RAM became an issue. I have tried adding a variable as well as a string into the record line but I receive the error message below. The library states the startRecording() function must be written as such: void startRecording(char *fileName, unsigned int SAMPLE_RATE, byte pin, byte passThrough); and the stopRecording as such: void stopRecording(char *fileName);
/Users/Tristan/Documents/Arduino/SpeakerCorner/SpeakerCorner.ino: In function 'void loop()':
SpeakerCorner:41:63: error: no matching function for call to 'TMRpcm::startRecording(StringSumHelper&, int, const uint8_t&)'
audio.startRecording(String(audiofile)+".wav", 16000, A0); break;
^
In file included from /Users/Tristan/Documents/Arduino/SpeakerCorner/SpeakerCorner.ino:4:0:
/Users/Tristan/Documents/Arduino/libraries/TMRpcm/TMRpcm.h:76:8: note: candidate: void TMRpcm::startRecording(char*, unsigned int, byte)
void startRecording(char* fileName, unsigned int SAMPLE_RATE, byte pin);
^
/Users/Tristan/Documents/Arduino/libraries/TMRpcm/TMRpcm.h:76:8: note: no known conversion for argument 1 from 'StringSumHelper' to 'char*'
/Users/Tristan/Documents/Arduino/libraries/TMRpcm/TMRpcm.h:77:8: note: candidate: void TMRpcm::startRecording(char*, unsigned int, byte, byte)
void startRecording(char *fileName, unsigned int SAMPLE_RATE, byte pin, byte passThrough);
^
/Users/Tristan/Documents/Arduino/libraries/TMRpcm/TMRpcm.h:77:8: note: candidate expects 4 arguments, 3 provided
SpeakerCorner:41:66: error: break statement not within loop or switch
audio.startRecording(String(audiofile)+".wav", 16000, A0); break;
^
SpeakerCorner:153:49: error: no matching function for call to 'TMRpcm::stopRecording(StringSumHelper&)'
audio.stopRecording(String(audiofile)+".wav"); break;
^
In file included from /Users/Tristan/Documents/Arduino/SpeakerCorner/SpeakerCorner.ino:4:0:
/Users/Tristan/Documents/Arduino/libraries/TMRpcm/TMRpcm.h:78:8: note: candidate: void TMRpcm::stopRecording(char*)
void stopRecording(char *fileName);
^
/Users/Tristan/Documents/Arduino/libraries/TMRpcm/TMRpcm.h:78:8: note: no known conversion for argument 1 from 'StringSumHelper' to 'char*'
SpeakerCorner:153:52: error: break statement not within loop or switch
audio.stopRecording(String(audiofile)+".wav"); break;
THIS IS MY CODE BELOW
//////////////////////////////////////// SD CARD
#include <SD.h>
#include <SPI.h>
#include <TMRpcm.h>
#define SD_ChipSelectPin 10
TMRpcm audio;
//////////////////////////////////////// SWITCH CASE
int audiofile = 0; // # of recording
unsigned long i = 0;
bool recmode = 0; // recording state
//////////////////////////////////////// SWITCH
int inPin = 2; // input Switch Pin
int state = HIGH; // the current state switch
int reading; // the current reading from the switch
void setup() {
Serial.begin(9600);
pinMode(A0, INPUT); // Microphone
pinMode(inPin, INPUT_PULLUP); // Switch
//////////////////////////////////////// SD CARD
SD.begin(SD_ChipSelectPin);
audio.CSPin = SD_ChipSelectPin;
}
void loop() {
reading = digitalRead(inPin);
////////////////////////////////////////
while (i < 300000) {
i++;
}
i = 0;
////////////////////////////////////////
if (reading == LOW) {
if (recmode == 0) {
recmode = 1;
Serial.println("Recording");
audiofile++; // To move case
audio.startRecording(String(audiofile)+".wav", 16000, A0); break;
}
}
////////////////////////////////////////
else if (reading == HIGH) {
recmode = 0;
Serial.println("Hung-Up");
audio.stopRecording(String(audiofile)+".wav"); break;
}
}