hello,
i have a project with a Keyes USB_Host_Shield, Arduino Uno and a USB barcode scanner.
i downloaded from gridhub and some other sits a code and it is working at home fine. but at work it will not work i tested it on 3 computers form windos 8 to 10. But all 3 compurters at work it will not work.
a copyed the libarys ( USB_Host_Shield_2.0-master and USBHID) from my home computer to the work computers bus still same error.
the error is:
cannot declare Variable 'Prs' to be of abstract type'KbdRptParser'
first i was thinking it is a fault in a libary but i can not find it.
does anyone has an idea where to look?
this is te code:
/*
Portable barcode scanner. Uses USB HID barcode scanner, Arduino Board, USB Host Shield
*/
#include <hid.h>
#include <hiduniversal.h>
#include <avr/pgmspace.h>
#include <Usb.h>
#include <usbhub.h>
#include <hidboot.h>
USB Usb;
USBHub Hub(&Usb);
HIDUniversal Hid(&Usb);
HIDBoot<HID_PROTOCOL_KEYBOARD> Keyboard(&Usb);
class KbdRptParser : public KeyboardReportParser
{
void PrintKey(uint8_t mod, uint8_t key);
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 ) {
Serial.print(" - start - ");
//Serial.println(" - Finished");
}//if( millis() > next_time ...
next_time = millis() + 200; //reset watchdog
Serial.print( (char)key );
};
KbdRptParser Prs;
void setup()
{
Serial.begin( 115200 );
Serial.println("Start");
if (Usb.Init() == -1) {
Serial.println("OSC did not start.");
}
delay( 200 );
Hid.SetReportParser(0, (HIDReportParser*)&Prs);
delay( 200 );
}
void loop()
{
Usb.Task();
}