Hey all,
I am working on a scanner which will save barcodes and the amount of products scanned.
So far I got the code working that it writes the 2 variables on the sd card from my nextion display and my barcode scanner is working on my serial monitor.
The only problem is I want to write the barcode when it scans to a text (t2.txt) on my nextion so it will show you on screen what barcode you have scanned.
the bit of code that isnt working is in the void loop, since I want the scanner to always pick up on new codes that are scanned:
void loop() {
myNex.NextionListen(); // WARNING: This function must be called repeatedly to response touch events
// from Nextion touch panel. Actually, you should place it in your loop function.
{
if (Barcode.available()) // Check if there is Incoming Data in the Serial Buffer.
{
while (Barcode.available()) // Keep reading Byte by Byte from the Buffer till the Buffer is empty
{
char input = Barcode.read(); // Read 1 Byte of data and store it in a character variable
Serial.print(input); // Print the Byte
delay(5); // A small delay
}
myNex.writeStr("t2.txt");
}
}
}
According to the easynextion github the syntax should work, yet it does not.
Does anyone know what I am doing wrong?
If you need more info I am happy to give that ofcourse.
Greets,
wigets