I am trying to use a barcode scaner with my portenta h7 and it is saying that there can't be any software serial and if I remove it and try to use serial1 to define the TX and RX pins it still doesnt work. Any ideas?
#define Serial1
Serial1 (13, 14);
#include "SparkFun_DE2120_Arduino_Library.h"
DE2120 scanner;
#define BUFFER_LEN 40
char scanBuffer[BUFFER_LEN];
void setup()
{
Serial1.begin(115200);
Serial.begin(115200);
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);
}