Waveshare barcode scanner Concern

Hi Arduino Family,

I have this project that I genuinely have no clue how to code. The projects consists of a Waveshare Barcode scanner (https://www.waveshare.com/barcode-scanner-module.htm), Arduino Uno R3, and LEDs. The idea of the project is for barcode to read two certain numbers in order to turn on one LED, if not the other LED turns on.

The basic code should run like this: (but I don't know how to code it.)

{
Code to connect barcode to Arduino software
Connect Barcode to Digital Pin 1
Connect RLED to Digital Pin 2
Connect NRLED to digital Pin 2

if barcode equals #0284000014235 or #078742040370
RLED turns on
wait 5 seconds
RLED turns off
else
NRLED turns on
wait 5 seconds
NRLED turns off
end
}

Please help in putting this in code, thank you very much Arduino family.

Have you read the manual? It appears to me the manual has a bunch of QR codes that will set the scanner for the UART mode. You should look at them.

Then google "Arduino serial input" or "Arduino UART". You will find some simple code that will allow your Arduino to read the scanner.

Do that before worrying about the LED control. When you can successfully read the output of the scanner then you can start thinking of how to control your LEDs.

BTW do you have a target that will generate the numbers you need to test?

Thank you for the help, and if by target you mean objects that the barcode will scan? Then, yes I do. The targets would be a water bottle, protein wrapper, chip bag, and soda can, all of which have the scanner is supposed to read the barcode on them.

Also, for the UART, do I need to buy a board that would allow the Arduino to communicate with the scanner? Or will the QR codes automatically program the scanner?

No. You can use software serial on the Arduino to read and write to the UART output of the scanner. The Tx pin on the Scanner will connect to the software serial Rx pin on the Arduino and the Rx pin on the scanner will connect to the software serial Tx pin on the Arduino.

Have you read this manual
https://www.waveshare.com/w/upload/d/dd/Barcode_Scanner_Module_Setting_Manual_EN.pdf

Another piece of advice would be to modify your original post and change the title of your posting to remove the word "Urgent". In my experience on this forum, it's more likely to produce a negative reaction among those who would help you than to encourage them to jump to your assistance.

Ok so I found the section of the manual whereto setting codes allow you to enable/disable the setting code function. Also, what is the purpose of Rx and Tx? Thank you very much for your help

NO.

UART is an acronym describing the serial input/output. Every Arduino has this capability. The pins are usually identified on a pinout diagram as "Tx" and "Rx".

Those are the two pins of the scanner that will send and receive serial data.

Do some google search on Uart.
Here's one result
https://www.circuitbasics.com/basics-uart-communication/

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