Displaying barcode information on the serial monitor

Hello.
I tried to run an example of reading a barcode using the gm65 module in Arduino Mega, but the serial monitor output is not working.
The following code is an example.

#include <SoftwareSerial.h>
SoftwareSerial GM65(2, 3); // RX, TX

void setup() {
  Serial.begin(9600);
  GM65.begin(9600); 
}

void loop() {
  if(GM65.available()){
    String barcode = GM65.readStringUntil('\n');
    Serial.println(barcode);
  }
}

I checked the board rate, circuit, UART interface settings, serial communication interface output settings
img1.daumcdn
, but the serial monitor is still not working.
(The USB output has been tested to confirm that it is working. Read the barcode and enter the information in Notepad.)

How can i solve this problem? If anyone has experienced the same problem as me, please reply. Thank you always for your help.
If you tell me the information you need to solve the problem, I will provide it.
I am sorry for my poor English...

Try changing to this...

  if(GM65.available() > 0)
  {
    Serial.write(GM65.read());
  }

... and advise what you get.

Still no response from the serial monitor..But Thank you for your reply. Is there any other solution that comes to mind?

If you add, after the line above ,
Serial.println("Starting...");

... does this print?

If it does then there is something wrong with the connection to the bar code reader.

Can you please supply details of how it is connected (schematic, pic, etc.).

What's a difference ?

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.