-1

i bought a qr code reader from banggood, here's the link: https://www.banggood.com/GM65-1D-2D-Code-Scanner-BarCode-Reader-QR-Code-Reader-Module-p-1440532.html?rmmds=buy

it works pretty well and i'm happy with its performances on my pc, but it just doesn't respond with the arduino, i tried conencting it via virtual serial port but i'm getting no signal back, here's the code

#include <AltSoftSerial.h>


AltSoftSerial scanner;


void setup() {


Serial.begin(9600);

scanner.begin(9600);




}

void loop() {


if(scanner.available()){


Serial.println("kek");


}

}

i connected the scanner's tx to pin 8 and the rx to pin 9 as requested by the altsoftserial library but it doesn't work either.

i tried running some troubleshooting and no matter what i do ( i tried using the manual https://www.dropbox.com/sh/buysgr2aeutuub3/AADsvupiGseFm-6IowMBWGCOa?dl=0GM66&preview=GM65+Barcode+reader+mudule+User+Manual.pdf and i scanned the necessary code) it doesn't seem to work.

basically scanner.available() is always zero no matter what i do.

  • 2
    how did you connect it to your PC? ... how did you connect it to the Arduino? – jsotola Jun 29 at 3:06
  • yes the scanner turns on and it's funcioning, the light works. it's just the rx and tx that seem not to be working. – federico saviano Jun 29 at 14:56
0

Don't use listen() this way. It clears the receive buffer. You loose the data received before listen() call.

You have only one SoftwareSerial instance so you don't need to call listen(). The listen() function clears the receive buffer because there is only one buffer for all SoftwareSerial instances.

| improve this answer | |
  • i changed the code but still 0 response. yeah the power cables are correctly connected. – federico saviano Jun 29 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.