I connected my barcode scanner to my arduino UNO Rev 3, it works and my scanner does scan barcodes but i just can't manage to get any output in my program:
We got exectly this but we changed the Nano board for a UNO. Can someone help me find a good code? Or can someone explain how to rewire it the right way to the UNO board?
The LCD is a problem for later but for now we really need a output.
Thanks everyone!
(this is the code we used earlier)
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 4); // RX, TX
void setup()
{
Serial.begin(9600);
mySerial.begin(9600); // set the data rate for the SoftwareSerial port
}
void loop()
{
if (mySerial.available()) // Check if there is Incoming Data in the Serial Buffer.
{
while (mySerial.available()) // Keep reading Byte by Byte from the Buffer till the Buffer is empty
{
char input = mySerial.read(); // Read 1 Byte of data and store it in a character variable
Serial.print(input); // Print the Byte
delay(5); // A small delay
}
Serial.println();
}
}