Hi everybody
I tried to connect the barcode scanner (Decoder U0 V7.31) to Arduino DUE. I googled but all the examples I found used a USB host shield. I tried to connect the scanner to native USB port and use the USBHost library.
I used Keyboard Controller example. Just to see if there is any response in Serial
#include <KeyboardController.h>
USBHost usb;
KeyboardController keyboard(usb);
void setup(){
Serial.begin(9600);
}
void loop(){
usb.Task();
}
void keyPressed() {
Serial.print("Pressed: ");
Serial.print(keyboard.getKey());
Serial.println();
}
I tried several variations, But I could not reach any result.
After that I tried to use the adapter TTL to USB and connected to a Serial port.
I set up the scanner to PS2 and RS232 But none of them brought me a result.
And tried The following code. (This code worked for me on HC-06).
String scan;
void setup()
{
Serial.begin(9600);
Serial3.begin(9600);
}
void loop()
{
while(!Serial3.available()){} //I tried also without this line
scan= Serial3.readString();
Serial.println(scan);
}
I do not know how to proceed from here. And what else can I try.
Does anyone have any suggestions? Thanks.