An addition of Human Input Device Class support to USB Host Shield library 2.0, announced several days ago allows using powerful and inexpensive input devices with USB interface in Arduino projects. Sample sketches demonstrating sending and receiving data to one of the most useful HID device types – boot keyboard/mouse, has been released along with the library. The beauty of boot protocol lies in the simplicity of device report – a data packet containing information about button presses and mouse movements. However, samples were designed to demonstrate all features of the class and because of that, they are somewhat heavy. In real-life applications, it is often not necessary to implement each and every virtual function – only what is needed. In today’s article I will show practical application of HID boot device building a simple gadget.
Originally, HID boot protocol was meant to be used with keyboards and mice. When USB became popular, other keyboard-emulating devices, such as barcode scanners and magnetic card readers have been migrated from PS/2 standard to USB while keeping their keyboard-emulating property. As a result, many modern “not-so-human” input devices behave exactly like a keyboard including boot protocol support. A gadget that I demonstrate today is portable autonomous barcode scanner built using Arduino board, USB Host shield, handheld USB barcode scanner and LCD display (see title picture). The operation is simple – when handheld scanner button is pressed, it scans the barcode and sends it to Arduino symbol by symbol. Arduino then outputs these symbols on LCD display. LCD is erased before outputting each new barcode by tracking time between arrival of two consecutive symbols. To keep the code simple, I intentionally did not implement any data processing, however, since Arduino sketch for the gadget compiles in just a little over 14K, there is plenty of memory space left for expansion.
Let’s talk a little bit about necessary parts. First of all, we’ll need Arduino board and USB Host Shield. I use standard 16×2 HD44780-compatible LCD display, connected similarly to one in Arduino LiquidCrystal tutorial. Since USB Host shield uses pins 11 and 12 to interface to Arduino, I had to move corrsponding LCD signals to pins 6 and 7; the rest of the connections shall be made exactly like in the tutorial. Lastly, we need compatible handheld barcode scanner. The best place to search for one is eBay; look for phrases “no driver required” and “USB HID device” in product description.
To make sure a device is indeed a boot keyboard, take a look at device descriptors using USB_Desc example from USB Host library – a sample output is given below. Class, Subclass, Protocol in interface descriptor (lines 29-31) should be 03, 01, 01. If Subclass is zero, boot protocol is not supported. Non-boot scanner is still useful but accessing it is going to be slightly more complicated. I will cover HID report protocol in one of the next articles.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | Device descriptor: Descriptor Length: 12 Descriptor type: 01 USB version: 0100 Device class: 00 Device Subclass: 00 Device Protocol: 00 Max.packet size: 08 Vendor ID: 04B4 Product ID: 0100 Revision ID: 0100 Mfg.string index: 01 Prod.string index: 02 Serial number index: 00 Number of conf.: 01 Configuration descriptor: Total length: 0022 Num.intf: 01 Conf.value: 01 Conf.string: 04 Attr.: A0 Max.pwr: 64 Interface descriptor: Intf.number: 00 Alt.: 00 Endpoints: 01 Intf. Class: 03 Intf. Subclass: 01 Intf. Protocol: 01 Intf.string: 05 Unknown descriptor: Length: 09 Type: 21 Contents: 00011001223F000705 Endpoint descriptor: Endpoint address: 81 Attr.: 03 Max.pkt size: 0008 Polling interval: 0A |
Below is the sketch which needs to be compiled and loaded into Arduino. I wrote it by copying the keyboard example, taking out all unnecessary code and adding LCD support. The sketch can be copied from this page and pasted to Arduino IDE window. An explanation of key pieces is given after the listing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | /* Portable barcode scanner. Uses USB HID barcode scanner, Arduino Board, USB Host Shield and HD44780-compatible LCD display The circuit: * LCD RS pin to digital pin 7 * LCD Enable pin to digital pin 6 * LCD D4 pin to digital pin 5 * LCD D5 pin to digital pin 4 * LCD D6 pin to digital pin 3 * LCD D7 pin to digital pin 2 * LCD R/W pin to ground * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) */ #include <LiquidCrystal.h> #include <avr/pgmspace.h> #include <avrpins.h> #include <max3421e.h> #include <usbhost.h> #include <usb_ch9.h> #include <Usb.h> #include <usbhub.h> #include <avr/pgmspace.h> #include <address.h> #include <hidboot.h> #include <printhex.h> #include <message.h> #include <hexdump.h> #include <parsetools.h> #define DISPLAY_WIDTH 16 // initialize the LCD library with the numbers of the interface pins LiquidCrystal lcd(7, 6, 5, 4, 3, 2); USB Usb; //USBHub Hub(&Usb); HIDBoot<HID_PROTOCOL_KEYBOARD> Keyboard(&Usb); class KbdRptParser : public KeyboardReportParser { protected: virtual void OnKeyDown (uint8_t mod, uint8_t key); virtual void OnKeyPressed(uint8_t key); }; void KbdRptParser::OnKeyDown(uint8_t mod, uint8_t key) { uint8_t c = OemToAscii(mod, key); if (c) OnKeyPressed(c); } /* what to do when symbol arrives */ void KbdRptParser::OnKeyPressed(uint8_t key) { static uint32_t next_time = 0; //watchdog static uint8_t current_cursor = 0; //tracks current cursor position if( millis() > next_time ) { lcd.clear(); current_cursor = 0; delay( 5 ); //LCD-specific lcd.setCursor( 0,0 ); }//if( millis() > next_time ... next_time = millis() + 200; //reset watchdog if( current_cursor++ == ( DISPLAY_WIDTH + 1 )) { //switch to second line if cursor outside the screen lcd.setCursor( 0,1 ); } Serial.println( key ); lcd.print( key ); }; KbdRptParser Prs; void setup() { Serial.begin( 115200 ); Serial.println("Start"); if (Usb.Init() == -1) { Serial.println("OSC did not start."); } delay( 200 ); Keyboard.SetReportParser(0, (HIDReportParser*)&Prs); // set up the LCD's number of columns and rows: lcd.begin(DISPLAY_WIDTH, 2); lcd.clear(); lcd.noAutoscroll(); lcd.print("Ready"); delay( 200 ); } void loop() { Usb.Task(); } |
- Lines 5-15. This comment contains information about necessary LCD connections
- Lines 46-52.
KeyboardReportParser
declaration. Compare with keyboard example. Here, we only needOnKeyDown()
andOnKeyPressed()
methods. - Lines 54-60.
OnKeyDown()
callback definition. When a keyboard key is pressed, it receives scan code of this key plus modifiers (Ctrl, Alt, Shift). Since our LCD takes ASCII codes the callback performs scan code to ASCII conversion and then callsOnKeyPressed()
- Line 63.
OnKeyPressed()
definition - Lines 68-73.Clears the display before outputting first symbol of new barcode, i.e., if pause between symbols is larger than 200ms. Note delay in line 71 – my display is old and slow and unless I wait a little, it won’t print the first symbol of the sequence. Newer displays should work fine without it
- Lines 81-82. The output. A symbol is sent to serial terminal and LCD
The rest of the sketch contains standard initialization of USB Host
and Liquidcrystal
libraries, as well as periodic calling of Usb.Task()
, from which keyboard callbacks are called.
Lastly, a bonus material for those who managed to keep reading the article to this place. Since the sketch assumes HID boot device, it can be used with many different devices. For example, it is possible to produce an output using ordinary keyboard (due to watchdod, in order to get more than one symbol on the LCD display, you’d have to type pretty fast). Also, the same setup makes pretty good RFID reader – many inexpensive USB readers in 125KHz class are implemented as HID boot keyboards. Picture on the left shows one such device connected to Arduino. It also shows a way of providing power via Arduino USB port using portable USB charger. RFID cloning, anyone?
Can you please show how this code could be modified to make use of the Max_LCD library instead of LiquidCrystal? (i.e. make use of the GPOUT pins on the shield itself)
Thank you!
Hi Oleg,
I’m interested in using this kind of project to help my company update statuses on orders. I have absolutely no idea what I’m doing, but I’ll need to hookup to the internet with the arduino. Would you suggest an Arduino Ethernet plus your USB shield – is that a good combo? Also, can you give me an example of an LCD display to use?
Hi Oleg,
I have a project in which i need to interface a barcode reader with Mbed.. Kindly reply if this can be done using and Mbed?
Secondly it will be very kind of you to mention more about the type of scanners that can be interfaced easily.mention a link so i could know what should i actually buy ..I will be very grateful to you for your help.
I’m not familiar with mbed, sorry.
Could anyone explain for me the line of code do?
HIDBoot Keyboard(&Usb);
what is the role of “” in this line of code?
Thank you.
Could anyone explain for me the line of code do?
HIDBoot Keyboard(&Usb);
what is the role of “ ” in this line of code?
Thank you.
Hello,im using an usb host shield and also lcd host shield with button..by the program..i still can’t understand how can arduino read the data from my barcode scanner..and how i can display into my lcd??
Hi,
I am using a barcode scanner connected to the Arduino Mega though UHS. The scanner works fine at the PC, but does not when connected to Arduino.
When the scanner is attached, we have the message:
BM Init
Addr:01
bAddr:01
bNumEP:02
totalEndpoints:0002
Cnf:01
If:00
BM configured
but the scanner does not work. The leds stay blinking and the scanner does not read any barcode, and also does not send anything to the USB Host.
The USB_desc output is:
Start
01
—
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0110
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 24EA
Product ID: 0197
Revision ID: 0200
Mfg.string index: 01
Prod.string index: 02
Serial number index: 00
Number of conf.: 01
Configuration descriptor:
Total length: 0022
Num.intf: 01
Conf.value: 01
Conf.string: 00
Attr.: 80
Max.pwr: C8
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 01
Intf. Class: 03
Intf. Subclass: 01
Intf. Protocol: 01
Intf.string: 00
Unknown descriptor:
Length: 09
Type: 21
Contents: 010100012240000705
Endpoint descriptor:
Endpoint address: 81
Attr.: 03
Max.pkt size: 0008
Polling interval: 0A
Addr:1(0.0.1)
The HID_desc is:
Start
0000: 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
0010: 95 08 75 01 81 02 95 01 75 08 81 01 05 08 19 01
0020: 29 03 95 03 75 01 91 02 95 05 75 01 91 01 95 06
0030: 75 08 15 00 26 E7 00 05 07 19 00 29 E7 81 00 C0
0040: 00 00 00 00 00 00 00 00 00 00
Usage Page Gen Desktop Ctrls(01)
Usage Keypad
Collection Application
Usage Page Kbrd/Keypad(07)
Usage Min(E0)
Usage Max(E7)
Logical Min(00)
Logical Max(01)
Report Count(08)
Report Size(01)
Input(00000010)
Report Count(01)
Report Size(08)
Input(00000001)
Usage Page LEDs(08)
Usage Min(01)
Usage Max(03)
Report Count(03)
Report Size(01)
Output(00000010)
Report Count(05)
Report Size(01)
Output(00000001)
Report Count(06)
Report Size(08)
Logical Min(00)
Logical Max(E700)
Usage Page Kbrd/Keypad(07)
Usage Min(00)
Usage Max(E7)
Input(00000000)
End Collection
Do you have any advice?
Thanks
In HID_desc, are you getting anything when you’re trying to scan? Also, which sketch were you using to produce the first output?
Yeah, the scanner works fine.
The output below was produced by setting “#define ENABLE_UHS_DEBUGGING 1” in settings.h.
BM Init
Addr:01
bAddr:01
bNumEP:02
totalEndpoints:0002
Cnf:01
If:00
BM configured
The other outputs were produced by using the sketch examples USB_desc and USBHID_desc from the github repository.
Hi friend, I got it.
Hello Afonso i am getting the same problem .
Can u please tell me how u fixed it ?
hi oleg, really2 thanks for the code. It works fine with my logitech keyboard.
but when I try to use it with argox as-8000 barcode scanner, it seems hang or sometime it says osc didnot start.
when use board_qc sometime work, mostly not. but when I use lib version 1, board_test always works fine.
Please need help. Thx
Which shield are you using?
below is usb desc, almost the same as your example. just different on max pwr. does it need extra power? if yes, how to do?
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0110
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 08
Vendor ID: 04B4
Product ID: 0100
Revision ID: 0001
Mfg.string index: 01
Prod.string index: 02
Serial number index: 00
Number of conf.: 01
Configuration descriptor:
Total length: 0022
Num.intf: 01
Conf.value: 01
Conf.string: 04
Attr.: A0
Max.pwr: 32
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 01
Intf. Class: 03
Intf. Subclass: 01
Intf. Protocol: 01
Intf.string: 05
Unknown descriptor:
Length: 09
Type: 21
Contents: 00010001223F000705
Endpoint descriptor:
Endpoint address: 81
Attr.: 03
Max.pkt size: 0008
Polling interval: 0A
Addr:1(0.0.1)
This looks like a boot keyboard to me – does it work when plugged into a PC?
yes, work fine on pc. it is a barcode scanner. argox as8000. any idea?
Do you have any manufacturer’s drivers for the device installed on this PC? Can you double-check on a clean PC? If it work on standard system, then your issue is likely power – try to run Arduino from external power supply.
Thanks oleg, now succeed sent barcode to a web server. arduino, usb host shield and ethernet shield. I modified a bit on file usbcore.h
Many thanks again
Hi.
Could you send me your codes? same above codes?
My barcode reader is simillrary to yours.
I do not know why that code does not work…
have you tried the code from the page?
Of course.. But it did not work.
complie and uploard is fine. SO.. when I pressed barcode button, nothing is happened.
I wrote modified code below comments.
Could you give me an advice? plz..
can you see “Start” message? Do you have your terminal set to 115200?
I just want to show the output in the seiral monitor(PC), not LCD.
Yes. I can see “Start” message.. and I set terminal to 115200.
This is my barcode reader. do you have any idea?..
Start
01
—
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0110 /////////
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40 ////////
Vendor ID: 04B4
Product ID: 0100
Revision ID: 0001 ///////
Mfg.string index: 01
Prod.string index: 02
Serial number index: 00
Number of conf.: 01
Configuration descriptor:
Total length: 0022
Num.intf: 01
Conf.value: 01
Conf.string: 00 //////
Attr.: C0 //////
Max.pwr: 96 //////
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 01
Intf. Class: 03
Intf. Subclass: 01
Intf. Protocol: 01
Intf.string: 05
Unknown descriptor:
Length: 09
Type: 21
Contents: 00010001223F000705
Endpoint descriptor:
Endpoint address: 81
Attr.: 03
Max.pkt size: 0008
Polling interval: 01
Addr:1(0.0.1)
Try to connect a regular keyboard and see if it works. Also, make sure to power your Arduino from external supply.
Hi. Oleg. I solved the problem. The device was the problems.
Anyway.. How to delete the comments that I wrote?
I want to delete my codes.
Hi Oleg, I think you’re right. We decide to buy another barcode scanner. Will get back after we bought it today.
Mean while, if I want to use usb host shield an ethernet shield together, I guest I need to modify the SS pin so it would not conflict. If I am right, so I need to modify avrpins.h?
Hi oleg, apparently it is power issue. Still use old barcode (argox) and now it works. Next target is send it over ip.
Thanks again, any clue on send it aver ip?
It works now on lib version 2 but still could not read an argox barcode scanner
Below, USBHID_desc from my barcode scanner and have tried read barcode
Start
HU Init
Addr:01
NC:01
Cnf:01
HU configured
0000: 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
0010: 75 01 95 08 81 02 95 01 75 08 81 01 95 05 75 01
0020: 05 08 19 01 29 05 91 02 95 01 75 03 91 01 95 06
0030: 75 08 15 00 25 FF 05 07 19 00 29 FF 81 00 C0
Usage Page Gen Desktop Ctrls(01)
Usage Keypad
Collection Application
Usage Page Kbrd/Keypad(07)
Usage Min(E0)
Usage Max(E7)
Logical Min(00)
Logical Max(01)
Report Size(01)
Report Count(08)
Input(00000010)
Report Count(01)
Report Size(08)
Input(00000001)
Report Count(05)
Report Size(01)
Usage Page LEDs(08)
Usage Min(01)
Usage Max(05)
Output(00000010)
Report Count(01)
Report Size(03)
Output(00000001)
Report Count(06)
Report Size(08)
Logical Min(00)
Logical Max(FF)
Usage Page Kbrd/Keypad(07)
Usage Min(00)
Usage Max(FF)
Input(00000000)
End Collection
hi, bintanghd, I want to know how setup u setup all of this project, because my project already same equipment but i cant get the output result. why? interface for HID, usb desc I cant get any point.. please help me!!
Hi Amre, I’ll be glad to assist you. I only arrange SS pin to pin 6 instead of 10. Because it has conflict with ethernet shield
Hello bintanghd, I have exactly the same configuration – Arduino Due + Ethernet shield + USB Host shield. But the ethernet stops to work after USB.Init(). SS signal was re-routed as Circuits@home suggests.
I saw some people here have the same problem.
I guess you were not an exception, so how did you solve it? I am pretty sure it is a software issue now.
hi, i just want to extract the barcode and not print it on the lcd then will the same code work if i use it till the 60th line? the “key” variable will have all the bits of the scanned number right?
thanks
As-is, it will print the barcode on the serial terminal, the LCD is optional really. Simply don’t connect it if you don’t need it.
Hi Oleg,
Initially I managed to run this example using my barcode reader (removed LCD code, just using Serial.println’s).
In order to connect an ethernet shield, I moved SS pin to 5 (modifying UsbCore.h to say typedef MAX3421e MAX3421E;) – the code continued to work.
However, when physically connecting the ethernet shield on top of the usb host shield, the example stopped working. I double checked that pin 10 is no longer connected to SS on the host shield as before.
I did find out that when bending the ethernet shield’s pin 10 so that it does not get connected, the example returns to working fine.
Could you advise a course of action here?
at least what can I do to investigate what’s happening?
Thanks!
Zvika
Some shields which use SPI won’t release the bus when not active. My shield does release the bus but if there is another one which doesn’t there is no remedy other than remove it and find one which was designed properly.
Thanks!
Do you mean that while not transmitting/receiving the bus pins (11-13) are not left floating as required? Isn’t there something that can be done via hacking? like, watching pin 10 and physically disconnecting pins 11-13 via optocouplers (?) when it is not active?
Also, since I am using the semi-official Ethernet shield (Wiz5100 manufactured in the far East) – from your experience may moving to the European ones fix the problem? I’ve been reading about people who did manage to connect USB host shield and the ethernet shield together without much hassle.
You only need to disconnect MISO as other lines are inputs to the SPI slave.
Hi Oleg,
can you send me the code for the rfid reader?
Ive bought the same and now id like to read out my tags.
Thanks to you and have a good night.
Kind regards Mukelpump
There is no code specific to the reader, from USB side it is just a boot keyboard.
Hi!
Thank you so much for publishing this! I do not have the LCD, nor am I planning on getting it, I am just trying to use the barcode scanner to read different IDs using your code or even just the keyboard example code, but I keep getting outputs in this form:
üþÿýýüüþþþþþÿÿýýüÿþþÿÿþ
do you have any ideas of what could be going wrong?
Thanks so much and have a great weekend
Check the serial speed of your terminal – should be set to 115200.
Hi Oleg.
I did this project with UNO, USB Host Sheild, Barcode scanner.
Why result is not shown up in serial monitor? I want to show the barcodes in serial monitor.
This is codes.
#include
#include
// Satisfy IDE, which only needs to see the include statment in the ino.
#ifdef dobogusinclude
#include
#endif
USB Usb;
//USBHub Hub(&Usb);
HIDBoot Keyboard(&Usb);
class KbdRptParser : public KeyboardReportParser
{
protected:
virtual void OnKeyDown (uint8_t mod, uint8_t key);
virtual void OnKeyPressed(uint8_t key);
};
void KbdRptParser::OnKeyDown(uint8_t mod, uint8_t key)
{
uint8_t c = OemToAscii(mod, key);
if (c)
OnKeyPressed(c);
}
/* what to do when symbol arrives */
void KbdRptParser::OnKeyPressed(uint8_t key)
{
Serial.println( key );
};
KbdRptParser Prs;
void setup()
{
Serial.begin( 115200 );
Serial.println(“Start”);
if (Usb.Init() == -1) {
Serial.println(“OSC did not start.”);
}
delay( 200 );
Keyboard.SetReportParser(0, (HIDReportParser*)&Prs);
// set up the LCD’s number of columns and rows:
delay( 200 );
}
void loop()
{
Usb.Task();
}
Example of HIDmouse worked as well.
Dear oleg
i’ve copied your code on my arduino ide and when i verified it it gave me the next failure messages :
cannot declare variable ‘keyboard’ to of be abstract type ‘HIDBoot’
cannot declare variable ‘HUB1; to of be abstract type ‘USBhub;
what this could mean and how could i overcome this problem
thank you and greetings
Do you have USB host library installed -> https://github.com/felis/USB_Host_Shield_2.0 ?
hi oleg, im thankfull that you share the code of your, but i tried to connect my barcode scanner to usb host shield with my arduino, the code works fine no problem on uploading to arduino but when i start with serail monitor only “start” i can see, when i scan a bar code it didn’t appear on the serial monitor.. can you help me?
Does your scanner work when you connect it to a PC?
yup..i tested it in note pad it works when it is connected on my pc..
The next step is power. HID devices are sensitive, make sure your Arduino runs off of external supply.
should i separate the power source of the scanner from the USB host shield? this is the model# of my scanner SCN-006-NL(C10-B)
shouldn’t be necessary unless you have Mini. Full-sized shield works from Arduino 5V, which is adequate if you run it from external supply.
my power supply of the host shield is from the main board of arduino which is 5v, i tried to run the program w/o the scanner then nothing happen but when i connected the scanner it shows the message again “start”, so it mean it initialized the scanner, right?
No. “Start” is basically printed to prove that your terminal is set correctly.
Try running board_qc (with any device, even unsupported one) – it should print you a device descriptor at the end. See if you can get it with scanner attached.
Start
01
—
Device descriptor:
Descriptor Length: 12
Descriptor type: 01
USB version: 0110
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 04B4
Product ID: 0100
Revision ID: 0001
Mfg.string index: 01
Prod.string index: 02
Serial number index: 00
Number of conf.: 01
Configuration descriptor:
Total length: 0022
Num.intf: 01
Conf.value: 01
Conf.string: 00
Attr.: C0
Max.pwr: 96
Interface descriptor:
Intf.number: 00
Alt.: 00
Endpoints: 01
Intf. Class: 03
Intf. Subclass: 01
Intf. Protocol: 01
Intf.string: 05
Unknown descriptor:
Length: 09
Type: 21
Contents: 00010001223F000705
Endpoint descriptor:
Endpoint address: 81
Attr.: 03
Max.pkt size: 0008
Polling interval: 01
Addr:1(0.0.1)
here what i got, using usb_desc.. what is the prob?
Looks good, should work fine. Which shield do you have?
USB HOST Shield, from this site.. http://www.e-gizmo.com/KIT/usb%20host%20shield.html i hope we can work this thing out, we have to present 10% working of our device..:)
I have no idea what this is.
by the way thank you Oleg, ill just keep in touch with you till i config the device, thanks for the time..
Hey Oleg,
I appreciate all this info. This is my second try at a comment (first one got erased).
I need your help/advise. I have a group of students that are going to start working on a project in 1 week. I’ve never ever worked with Arduino so I just picked up a few books to catch up. Anyways, they’ll be connecting a fine line barcode scanner to an arduino and outputting to multiple LED options depending on the data read by the scanned. What I’m trying to accomplish is that they scan a part and depending on the length it gets sorted into the correct bin that is light up by an LED. Any suggestions on what board I should buy and codes I can reference.
Thanks!
hi oleg, im compiling the your code with the USB host shield library that i downloaded from this site but error..
In file included from Barcode1.cpp:4:
C:\Users\win7\Documents\Arduino\libraries\USB_Host_Shield_20/avrpins.h:21:2: error: #error “Never include avrpins.h directly; include Usb.h instead”
In file included from Barcode1.cpp:5:
C:\Users\win7\Documents\Arduino\libraries\USB_Host_Shield_20/max3421e.h:18:2: error: #error “Never include max3421e.h directly; include Usb.h instead”
In file included from Barcode1.cpp:6:
C:\Users\win7\Documents\Arduino\libraries\USB_Host_Shield_20/usbhost.h:21:2: error: #error “Never include usbhost.h directly; include Usb.h instead”
In file included from Barcode1.cpp:7:
C:\Users\win7\Documents\Arduino\libraries\USB_Host_Shield_20/usb_ch9.h:19:2: error: #error “Never include usb_ch9.h directly; include Usb.h instead”
In file included from Barcode1.cpp:11:
C:\Users\win7\Documents\Arduino\libraries\USB_Host_Shield_20/address.h:19:2: error: #error “Never include address.h directly; include Usb.h instead”
In file included from Barcode1.cpp:14:
C:\Users\win7\Documents\Arduino\libraries\USB_Host_Shield_20/printhex.h:19:2: error: #error “Never include printhex.h directly; include Usb.h instead”
In file included from Barcode1.cpp:15:
C:\Users\win7\Documents\Arduino\libraries\USB_Host_Shield_20/message.h:18:2: error: #error “Never include message.h directly; include Usb.h instead”
In file included from Barcode1.cpp:16:
C:\Users\win7\Documents\Arduino\libraries\USB_Host_Shield_20/hexdump.h:18:2: error: #error “Never include hexdump.h directly; include Usb.h instead”
In file included from Barcode1.cpp:17:
C:\Users\win7\Documents\Arduino\libraries\USB_Host_Shield_20/parsetools.h:19:2: error: #error “Never include parsetools.h directly; include Usb.h instead”
what is the problem?
hi oleg its me again, can u help me how to make the output of the barcode scanner into a String? here’s the code..
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define DISPLAY_WIDTH 16
int txt;
String barcode;
String readString;
const int NUMBER_OF_PRODUCTS = 8;
const int MAX_SCANNED_PRODUCTS = 15;
const String ERROR_MSG = “Invalid barcode”;
const String productNames[NUMBER_OF_PRODUCTS] = {“BarcodeScanner”,”notebook”,”Honey”,”Deodorant Spray”,”Milk”,”Coffee”,”Water”,”Eggs”};
const String productBarCodes[NUMBER_OF_PRODUCTS] = {“XLY-890/111121332″,”2″,”3″,”8711600633896″,”5020201473866″,”5011546415482″,”5010358147024″,”5024550316003”};
String scannedProducts[MAX_SCANNED_PRODUCTS] = {“xxx”,”xxx”,”xxx”,”xxx”,”xxx”,”xxx”,”xxx”,”xxx”,”xxx”,”xxx”,”xxx”,”xxx”,”xxx”,”xxx”,”xxx”};
int numScannedProducts = 0;
String newProductBarCode = “”;
String newProductName = “”;
bool shoppingListSent = false;
int productIndex(String scannedBarcode) {
for (int i=0; i”);
PrintHex(key);
Serial.print(” next_time ) {
lcd.clear();
current_cursor = 0;
delay( 5 ); //LCD-specific
lcd.setCursor( 0,0 );
}//if( millis() > next_time …
next_time = millis() + 200; //reset watchdog
if( current_cursor++ == ( DISPLAY_WIDTH + 1 )) { //switch to second line if cursor outside the screen
lcd.setCursor( 0,1 );
}
Serial.print((char)key);
lcd.print((char)key);
barcode = String((char)key);
if (barcode == productBarCodes[NUMBER_OF_PRODUCTS]) {
lcd.clear();
if (productIndex(newProductBarCode) == -1) {
lcd.print(ERROR_MSG);
Serial.print(ERROR_MSG);
} else {
newProductName = productNames[productIndex(newProductBarCode)];
addNewProduct(newProductName);
lcd.print(“Pr.#” + String(numScannedProducts) + “: ” + newProductName);
Serial.print(“Pr.#” + String(numScannedProducts) + “: ” + newProductName);
}
newProductBarCode = “”;
} else {
newProductBarCode.concat(barcode);
}
};
USB Usb;
//USBHub Hub(&Usb);
HIDBoot Keyboard(&Usb);
uint32_t next_time;
KbdRptParser Prs;
void setup(){
/*{ // Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print(“Initializing SD card…”);
// make sure that the default chip select pin is set to
// output, even if you don’t use it:
pinMode(10, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println(“Card failed, or not present”);
// don’t do anything more:
return;
}
Serial.println(“card initialized.”);*/
Serial.begin(115200);
Serial.println(“Start”);
if (Usb.Init() == -1)
Serial.println(“OSC did not start.”);
delay( 200 );
next_time = 0;//millis() + 5000;
Keyboard.SetReportParser(0, (HIDReportParser*)&Prs);
lcd.begin(DISPLAY_WIDTH, 4);
lcd.clear();
lcd.noAutoscroll();
lcd.print(“Ready”);
delay( 200 );
}
void loop()
{
Usb.Task();
}
never mind the SD part, its just the ((char)key); i want to be in a string, only 1 char is encode to the string, i need the whole char of the output from barcode scanner tact into the string
Hello,
I need help
I have a project for my activity which is as follows:
1. I have to scan a barcode with a standalone module requiring no PC, (I think a card type ‘Arduino’ with a bar code reader)
2 – I need to send a different part of the barcode to three independent displays (2 digit 7-segment) using a wireless communication (I think to Xbee modules powered by batteries)
Example:
Bar code: 1234567890123
The first display should show «23»
The second display must display ’56 ‘.
The third display must display ’90.
Can you help me, I am beginner in the Arduino world.
Thank you in advance, and agree for a small remuneration.
Hello! Oleg,
Thanks for this post.
I am using a Arduino HOST USB shield on UNO to read a barcode from your example… but the ASCII values printed on the serial are different than what is scanned…
Tried the KeyboardHID example from USBshield 2.0 library.
These are the descriptor values below by executing USBHOST_desc
Start
0000: 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01
0010: 75 01 95 08 81 02 95 01 75 08 81 01 95 03 75 01
0020: 05 08 19 01 29 03 91 02 95 05 75 01 91 01 95 06
0030: 75 08 15 00 26 FF 00 05 07 19 00 2A FF 00 81 00
0040: C0
Usage Page Gen Desktop Ctrls(01)
Usage Keypad
Collection Application
Usage Page Kbrd/Keypad(07)
Usage Min(E0)
Usage Max(E7)
Logical Min(00)
Logical Max(01)
Report Size(01)
Report Count(08)
Input(00000010)
Report Count(01)
Report Size(08)
Input(00000001)
Report Count(03)
Report Size(01)
Usage Page LEDs(08)
Usage Min(01)
Usage Max(03)
Output(00000010)
Report Count(05)
Report Size(01)
Output(00000001)
Report Count(06)
Report Size(08)
Logical Min(00)
Logical Max(FF00)
Usage Page Kbrd/Keypad(07)
Usage Min(00)
Usage Max(FF00)
Input(00000000)
End Collection
Please let me know if you could make any sense of it?
Regards,
Vikram
The output i get is bit weird when comparing the ascii table
http://www.papuaweb.org/info/tek/ascii-000-127.gif
Start
DN 36DN 35DN 33DN 39DN 30DN 34DN 31DN 30DN 30DN 39DN 39DN 38DN 31DN 40 => 7640152110092
DN 36DN 35DN 33DN 39DN 30DN 34DN 31DN 30DN 30DN 39DN 33DN 38DN 37DN 40 => 7640152110498
DN 36DN 35DN 33DN 39DN 30DN 34DN 31DN 30DN 30DN 38DN 31DN 36DN 38DN 40 => 7640152119279
=> is the actual value scanned
DN ’36’ is the key value printed before the oemtoascii is called
It is shifted by one. What happens when you plug just a regular keyboard?
I’m trying to compile this code, but the following error appears:
What is the problem?I have to change something in some library file, to be using a mega2560 plate? I really need help, please …
Arduino: 1.0.6 (Windows 7), Board: “Arduino Mega 2560 or Mega ADK”
In file included from OI.ino:4:
C:\Users\Thamire\Documents\arduino-1.0.6\libraries\USB_Host_Shield_2.0-master/avrpins.h:21:2: error: #error “Never include avrpins.h directly; include Usb.h instead”
In file included from OI.ino:5:
C:\Users\Thamire\Documents\arduino-1.0.6\libraries\USB_Host_Shield_2.0-master/max3421e.h:18:2: error: #error “Never include max3421e.h directly; include Usb.h instead”
In file included from OI.ino:6:
C:\Users\Thamire\Documents\arduino-1.0.6\libraries\USB_Host_Shield_2.0-master/usbhost.h:21:2: error: #error “Never include usbhost.h directly; include Usb.h instead”
In file included from OI.ino:7:
C:\Users\Thamire\Documents\arduino-1.0.6\libraries\USB_Host_Shield_2.0-master/usb_ch9.h:19:2: error: #error “Never include usb_ch9.h directly; include Usb.h instead”
In file included from OI.ino:11:
C:\Users\Thamire\Documents\arduino-1.0.6\libraries\USB_Host_Shield_2.0-master/address.h:19:2: error: #error “Never include address.h directly; include Usb.h instead”
In file included from OI.ino:14:
C:\Users\Thamire\Documents\arduino-1.0.6\libraries\USB_Host_Shield_2.0-master/printhex.h:19:2: error: #error “Never include printhex.h directly; include Usb.h instead”
In file included from OI.ino:15:
C:\Users\Thamire\Documents\arduino-1.0.6\libraries\USB_Host_Shield_2.0-master/message.h:18:2: error: #error “Never include message.h directly; include Usb.h instead”
In file included from OI.ino:16:
C:\Users\Thamire\Documents\arduino-1.0.6\libraries\USB_Host_Shield_2.0-master/hexdump.h:18:2: error: #error “Never include hexdump.h directly; include Usb.h instead”
In file included from OI.ino:17:
C:\Users\Thamire\Documents\arduino-1.0.6\libraries\USB_Host_Shield_2.0-master/parsetools.h:19:2: error: #error “Never include parsetools.h directly; include Usb.h instead”
Try 1.0.5
I have this problem…. Can you help me please? 😀
lector:44: error: conflicting declaration ‘HIDBoot Keyboard’
D:\Pygmalion\arduino-1.0.5-r2\hardware\arduino\cores\arduino/USBAPI.h:136: error: ‘Keyboard’ has a previous declaration as ‘Keyboard_ Keyboard’
lector.ino: In function ‘void setup()’:
lector:98: error: ‘class Keyboard_’ has no member named ‘SetReportParser’
Hi, this project it is possible with Arduino Yun? It have a USB port.
I don’t think so. You need to see if a software support is provided for this port.
Hello,
I don’t know about arduino I am alittel familure with VB.net
I want to learn Arduino any suggestions from where to start.
Thank you
I want to use USB Host Shield mini (which is 3.3V)
with Arduino Pro Micro (which is 5V)
I can supply 3.3V to USB Host Shield (VCC) (by using AMS1117)
Can I directly connect Arduino(5V) to Shield(3.3V) with following port (MOSI, MISO, CLK, INT)??
This will damage the shield or not?
And my barcode scanner need 5V from Shield
How and I supply that from arduino
Barcode Scanner USB Host Shield (3.3V) Arduino Pro Micro(5V) PC as a USB Keyboard
Barcode Scanner <==> USB Host Shield Mini(3.3V) <==> Arduino Pro Micro (5V) <==> PC
No, this is not recommended.
If i want to store in an array the numbers being read by the barcode scanner, in which part of the code can i do it?
Hi Oleg Mazurov,
I want to implement barcode scanner using Arduino USB Shield. I plan to buy Motorola LS1203. this scanner supports HID but i don’t know Intf. Class, Intf. Subclass and Intf. Protocol. Can you please tell me this scanner is working with Arduino or else suggest me some good scanner models working with Arduino.
In order for the barcode scanner to work with my sketches it should have the same class,subclass,protocol as the boot keyboard. Some scanners have this mode set at power-on, others need a command sent to it to switch to keyboard mode. You need one which works as a keyboard by default; sometimes it is stated in the description.
Hi,
It gives following error (with Arduino 1.0.5)
sketch_jul15a:41: error: ‘USB’ does not name a type
Can you explain why is this ?
Don’t use 1.0.5.
Hi,
Thanks Oleg for posting such a valuable project, as I said it gives me
sketch_jul15a:41: error: ‘USB’ does not name a type
for Arduino 1.0.5 and also for Arduino 1.0.1
Can I know the version you used here ? also any clue to convert this sketch to use with newer Aduino IDE & libraries
Thanks,
Dinesh
Have you tried using the 1.6.x versions of the IDE?
Yes,
Then it gives error can’t find “avrpins.h”
Any information about the Arduino version that initially used for this project ?
Are you using the latest library? (from GitHub?)
I have used Arduino IDE v 1.6.4 for my tests..
however.. I am only using the basic HDBootKBD example(s)…
Sorry.. I know these 1 line/word replies from Oleg are very frustrating, especially when they dont answer anything.
Hardware support for your purchase is great… getting answer/help on code/library stuff.. is extremely difficult.
Had I know how hard it was to get answers… I might have purchased elsewhere..(but then again.. its the only mini shield I had found)
Maybe post on the Arduino forums? or the Google+ group?
Hi Oleg (or anyone else with a solution),
I am trying to follow your example exactly. I have a Circuits@Home USB Host Shield on an Arduino Mega 2560. I do not seem to be able to get past the first step where you check the USB device using USB_desc. When I run that program, I get:
Start
OSC did not start
I have tried running on two different UNOs. I have tried on version 1.0.5 and 1.6.5.
Does anyone have any suggestions on how I might get the USB to initialize (Usb_Init)?
I get power to my barcode scanner and it scans and beeps, but no numbers appear in the Serial Monitor.
I also bought a Cuecat just to see if I could get that to work, but it returns the same message.
Thanks in advance for any help.
Have you tried to run board_qc? This is what I use to test shields before shipping. https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/board_qc
Hi Oleg,
I ran the board_qc program and this is what I got.
Circuits At Home 2011
USB Host Shield Quality Control Routine
Reading REVISION register… Die revision invalid. Value returned: 00
Unrecoverable error – test halted!!
0x55 pattern is transmitted via SPI
Press RESET to restart test
Thanks for your time!
Do you have 2×3 connector installed?
Hi Oleg,
Nothing else is connected. Just the Shield plugged into the Arduino.
I am trying to copy as exactly as I can your example.
Thanks
HOW CAN I FIX THIS ERROR??? IM A BEGINNER.
WE NEED THIS TO OUR THESIS.
USB_desc:26: error: ‘prog_char’ does not name a type
USB_desc:26: error: ISO C++ forbids declaration of ‘str’ with no type [-fpermissive]
USB_desc.pde: In function ‘void PrintDescriptors(uint8_t)’:
USB_desc:75: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:85: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc.pde: In function ‘byte getdevdescr(byte, byte&)’:
USB_desc:124: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:125: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:127: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:129: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:131: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:133: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:135: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:137: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:139: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:141: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:143: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:145: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:147: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:149: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:151: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc.pde: In function ‘void printhubdescr(uint8_t*, uint8_t)’:
USB_desc:162: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:163: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:166: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:169: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:172: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:175: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:178: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:181: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:184: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:187: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:190: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:193: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc.pde: In function ‘byte getconfdescr(byte, byte)’:
USB_desc:215: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc.pde: In function ‘void printconfdescr(uint8_t*)’:
USB_desc:269: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:270: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:272: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:274: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:276: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:278: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:280: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc.pde: In function ‘void printintfdescr(uint8_t*)’:
USB_desc:288: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:289: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:291: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:293: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:295: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:297: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:299: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:301: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc.pde: In function ‘void printepdescr(uint8_t*)’:
USB_desc:309: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:310: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:312: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:314: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:316: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc.pde: In function ‘void printunkdescr(uint8_t*)’:
USB_desc:326: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:327: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:329: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc:331: error: cannot convert ‘const char*’ to ‘const int*’ for argument ‘1’ to ‘void printProgStr(const int*)’
USB_desc.pde: At global scope:
USB_desc:341: error: ‘prog_char’ does not name a type
HI, I get following error
sketch_jan26a.ino:47:10: error: ‘HID_PROTOCOL_KEYBOARD’ was not declared in this scope
thank you
Ok, got it to work with the Arduino Uno. The problem was the USB host library. You must use the library dated 1-3-15 and not the newest one dated 20-01-16.
Now I am trying to make it work with the Arduino DUE but I have a lot of compiling errors. Can anyone tell me if it is possible to work with the Arduino DUE? Thank you.
Hi Oleg,
I am having a problem with this code.
It gets uploaded fine but on opening the serial monitor i get Start message,but on scanning a barcode nothing is printed on the lcd.
I Uploaded the USBHID desc code and this is what i get
Start
HU Init
Addr:01
NC:01
Cnf:01
HU configured
0000: 05 01 09 06 A1 01 95 08 75 01 05 07 19 E0 29 E7
0010: 15 00 25 01 81 02 95 01 75 08 81 01 95 06 75 08
0020: 15 00 25 FF 05 07 19 00 29 FF 81 00 C0
Usage Page Gen Desktop Ctrls(01)
Usage Keypad
Collection Application
Report Count(08)
Report Size(01)
Usage Page Kbrd/Keypad(07)
Usage Min(E0)
Usage Max(E7)
Logical Min(00)
Logical Max(01)
Input(00000010)
Report Count(01)
Report Size(08)
Input(00000001)
Report Count(06)
Report Size(08)
Logical Min(00)
Logical Max(FF)
Usage Page Kbrd/Keypad(07)
Usage Min(00)
Usage Max(FF)
Input(00000000)
End Collection
Hello
Now after following all your instructions i get the error
Cannot Declare Variable Prs to be of abstract type KbdRptParser.
Please Help