im developing an application where a list of RFID execute a list of media in html. The problem appeared when once i was able to read RFID UID i tried to catch it in my computer, so i tried the nodeJS module (serialport) and no worked, so i tried with python (pyserial) with python i was able write in the /dev/ttyACM0, but everytime i tried to read the content it displayed a blank space, rebooted the arduino and now Serial Monitor no shows up rfid data
The Arduino Uno has a circuit that causes it to reset whenever you open its serial port. So this result would be expected if you were opening the port before each read (as opposed to opening it only once and then reading from that previously opened port as needed).
When I'm having trouble with serial output, I like to do a quick check with the most simple possible sketch. If this works, then I know the problem has something to do with my real sketch. If it doesn't work, then I know the problem is not related to my sketch code. It seems maybe a little silly, but it allows me to be sure I'm focusing my troubleshooting efforts in the right direction.
Try uploading this sketch to your Arduino board:
Copy and paste this code as a new sketch in Arduino IDE:
This call returns a number that is how many bytes are left in the serial buffer for you to write in.
However you are not doing anything with this number you are simply throwing it away, why?
This is the definition of that call:-
byte n = Serial.availableForWrite();
Serial.println(n);
It would make more sense because it would tell you how much of the buffer you have to write in.
However, you don't seem to be writing anything anyway?
What did you want to do with that call?
You see to be printing only 4 bytes anyway so this would make more sense
while(Serial.availableForWrite() < 4) {
Serial.println("waiting for buffer to empty");
}
Serial.println("buffer now cleared")
But again there is absoloutly no reason to do this, because your serial buffer will empty faster than you can fill it. If you find it doesn't then simple set the baud rate to a much faster one.