I have a hard time uploading a piece of code in my Feather Basic Proto.
The problem goes like this: I click on upload on the IDE, i must always reset when uploading for IDE to find the serial port, the code is apparently uploaded, but when i want to open the serial monitor there is an error saying :
"the card on /dev/cu.usbmodem1421 isn't available" (translated from french)
Here is the code:
Code: Select all
#include <SD.h>
#include <SPI.h>
#include <TMRpcm.h>
#define SD_ChipSelectPin 10
TMRpcm audio;
int audiofile = 0;
unsigned long i = 0;
bool recmode = 0;
void setup() {
pinMode(A0, INPUT);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(2, INPUT_PULLUP);
attachInterrupt(0, button, LOW);
audio.CSPin = SD_ChipSelectPin;
while (!Serial);
Serial.begin(9600);
Serial.println("Audio recording test. hello");
if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("SD BAD :( ");
return;
} else {
Serial.println("SD OK");
}
// The audio library needs to know which CS pin to use for recording
audio.CSPin = SD_ChipSelectPin;
}
void loop() {
}
void button() {
while (i < 300000) {
i++;
}
i = 0;
if (recmode == 0) {
recmode = 1;
audiofile++;
digitalWrite(LED_BUILTIN, HIGH);
switch (audiofile) {
case 1: audio.startRecording("1.wav", 16000, A0);
Serial.println ("start recording 1.wav");
break;
case 2: audio.startRecording("2.wav", 16000, A0);
Serial.println ("start recording 2.wav"); break;
}}
else {
recmode = 0;
digitalWrite(LED_BUILTIN, LOW);
switch (audiofile) {
case 1: audio.stopRecording("1.wav");
Serial.println ("stopped recording 1.wav");
break;
case 2: audio.stopRecording("2.wav");
Serial.println ("stopped recording 2.wav"); break;
}}}
Important thing to note: It was working yesterday.
Could anyone help?