Thanks for the response. I've no idea what the angle brackets are doing, and the comment on the line is original. This is why I'm stumped! Apparently other people have managed to get this working, but I can't even get it to compile.....
Because there is a template involved. The HIDBoot template is trying to create an instance of the class that can deal with the type HID_PROTOCOL_KEYBOARD.
Thanks Robin, though I don't understand what you mean by a template. I understand how constructors & instances work, but I've never seen anything passed through the use of <>.
Any chance of expanding on it, as I've been trying everything that I can think of to resolve this, but failed miserably.
beerbotboffin:
and the comment on the line is original.
But did you try swapping the comment with the other line? and what happened?
Thanks Robin, though I don't understand what you mean by a template.
It was @PaulS who mentioned templates and I hope he will expand because I don't know either.
USB Usb();
HIDBoot <HID_PROTOCOL_KEYBOARD> Keyboard(&Usb);
It compiles after removing the empty brackets. ( **its not doing what you think**.
This is an example of a common usage that drives me nuts - calling the instance of a class by the same name as the class. It gives the novice user the impression that the name of the instance is significant when it could be any old name.
This is an example of a common usage that drives me nuts - calling the instance of a class by the same name as the class. It gives the novice user the impression that the name of the instance is significant when it could be any old name.
Could be worse. They could have called the instance myUsb. Now, there's something that drives me nuts.
I am having the same problem. This is the beginning of my code. I added hidboot.h but nothing changes. The error is the following:
sketch_jan26a:47: error: 'HID_PROTOCOL_KEYBOARD' was not declared in this scope
/*
Portable barcode scanner. Uses USB HID barcode scanner, Arduino Board, USB Host Shield and I2C LCD display
Original code from http://www.circuitsathome.com/mcu/connecting-barcode-scanner-arduino-usb-host-shield
Written by Oleg Mazurov
Mods by Shane Frost 20 Aug 2014
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <avr/pgmspace.h>
#include <Usb.h>
#include <hidboot.h>
USB Usb();
//USBHub Hub(&Usb);
HIDBoot<HID_PROTOCOL_KEYBOARD> Keyboard(&Usb);