I am trying to connect the Sparkfun DE2120 Barcode Scanner to my Arduino MKR WiFi 1010. Whenever I run the code below (which I modified slightly from the example in the library for the module) I only ever get the "Scanner did not respond. Please check wiring. Did you scan the POR232 barcode? Freezing.." message. My wiring is as follows:
Scanner Arduino
GND -> GND
3.3V -> VCC
TX -> 14
RX -> 13
I have confirmed that the scanner works using the USB interface and have made sure to scan the barcode to put it in TTL mode. Can anyone point me in the right direction as to what might be causing the issue?
#include "SparkFun_DE2120_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_DE2120
DE2120 scanner;
#define BUFFER_LEN 40
char scanBuffer[BUFFER_LEN];
void setup() {
Serial.begin(115200);
Serial1.begin(9600);
Serial.println("DE2120 Scanner Example");
if (scanner.begin(Serial1) == false) {
Serial.println("Scanner did not respond. Please check wiring. Did you scan the POR232 barcode? Freezing...");
while (1)
;
}
Serial.println("Scanner online!");
}
void loop() {
if (scanner.readBarcode(scanBuffer, BUFFER_LEN)) {
Serial.print("Code found: ");
for (int i = 0; i < strlen(scanBuffer); i++)
Serial.print(scanBuffer[i]);
Serial.println();
}
delay(200);
}