Serial trouble between IDE and Feather Basic Proto

Hi,

I have a hard time uploading a piece of code in my Feather Basic Proto from Adafruit

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 (maybe badly) from french)

Here is the code:

#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;

      
       }}}

I think the problem comes from the code itself because every other sketches, examples i tried are well uploaded on the card.

Also this sketch is uploaded and run well on my UNO board. Looks like this is a hate story between this sketch and this card :frowning:

Important thing to note: It was working yesterday.

Could anyone help?

Update: Update: I think it comes from the attachinterrupt function which i have to set as LOW in the setup

When i set it to CHANGE, the serial monitor open itself and the code is launched, but it won't work for my project

Do not cross-post. Other thread removed.