Page 1 of 1

Read RS232 Barcode Scanner

PostPosted: Fri Apr 12, 2019 12:18 am
by dreamsteven
From the tittle above i need some advice for my bar-code scanner .
I am using the RS232 barcode scanner
A RS232 to TTL converter
Arduino board using the Mega
Connect RS232 barcode scanner with Rs232 to TTL converter using a null RS232 modem

#include <SoftwareSerial.h>

SoftwareSerial mySerial(19, 18); // RX, TX

void setup() {

void loop() {
  if (mySerial.available()) {
    int val =;
  if (Serial.available()) {
    int val1 =;

RS232 to TTL converter's TxD and RxD are connected to arduino pin 18 and 19.
After the scanning TxD and Rxd not blinking at all.
Serial monitor also didnt have any outcome.

Re: Read RS232 Barcode Scanner

PostPosted: Sat Apr 13, 2019 5:22 am
by ober
Not familiar with the devices as we do not carry it, but looking at what you like to do, you are using Arduino mega as a USB to Serial bridge right?

Why don you just connect the RX and TX of the RS232 to TTL Converter to D0 and D1 or Mega, and reset the mega while testing it? Just connect a jumper wire from Reset pin to Gnd on the female header (near to power jack). This will keep Atmega2560 in reset mode and will not interrupt the USB to Serial IC on Mega itself.

BTW, it seem you did not initialize the software serial in your code, you "begin" hardware serial, but did not do anything with the softserial.