Yes, I do get the data on Arduino monitor. I started exactly from seeing the data on the serial monitor and then I decided I wanted them saved and tried this code. And also noticed I could not see serial monitor while Processing was running. I also checked already that the COM was correct,and in fact Processing only shows that Serial.list() = “COM3”. It is because the code still did not work that I asked for help.
By the way, I understood that the txt stayed empty because it could not enter the keyPressed statement, as I noticed that I could press all the keys I wanted but if the window of Processing was not selected it did not work. Stupid me.
As for why it did not show the values on the console, that I don’t really understand yet, but for the moment I’m happy as I got my .txt filled out.
Thank you very much anyway