I wrote a spectrum analyser program for a Teensy (using the Arduino IDE) a very long time ago, got a job and subsequently didn't program for a very long time. I'm revisiting it and trying to adapt it for a RPi Pico but I've fallen foul of my own terrible memory of some self taught coding on top of a shaky foundation to begin with.
I'm trying to use Serial.print to debug from within a class but if I enable any of the Serial functions, the program fails to even upload. Commenting out all of the Serial commands (just in the class) loads and runs.
I've tried to pass HardwareSerial into the constructor but exactly the same happens.
It actually compiles and uploads but a pop-up appears that made it appear that the upload had failed, whereas it was actually just failing to open the serial port. With the serial port not opening, the wait loop isn't completing so the board appears dead and can't be reprogrammed until reset.
Even with your changes I get the same.
The error is:
Port monitor error: command 'open' failed: no such file or directory. Could not connect to /dev/cu.usbmodem14101 serial port.
I thought it a possibility but wanted to check since I'm still trying to figure out what drugs I must have been taking when I wrote the original. I'm using a Mac and resisting having to switch to Visual Studio Code. I've used Eclipse in the past but it's been so long even that looks so insurmountably alien again.
I don't recall having a problem with the Teensy so perhaps it's a Pico issue.