Ajuda com erros

Bom dia a todos

Queria testar um programa no arduino uno que vi aqui: https://www.circuitsathome.com/mcu/connecting-barcode-scanner-arduino-usb-host-shield/

É para usar o USB host shield com leitor de código de barras e display

Como não tenho muita experiência na programação do arduino gostaria que me ajudassem nos erros que estou a ter quando compilo. O programa é baseado no exemplo da biblioteca USB host shield que já testei e compila sem erros.

Programa usado:

/*

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();
}

Segue relatório:

A usar a biblioteca LiquidCrystal na directoria: C:\Geral_Arquivo\Arduino\arduino-1.7.8\libraries\LiquidCrystal
A usar a biblioteca USB Host Shield Library 2.0 na directoria: C:\Users\Correia\Documents\Arduino\libraries\USB_Host_Shield_2.0
C:\Geral_Arquivo\Arduino\arduino-1.7.8/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10708 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Geral_Arquivo\Arduino\arduino-1.7.8\hardware\arduino\avr\cores\arduino -IC:\Geral_Arquivo\Arduino\arduino-1.7.8\hardware\arduino\avr\variants\standard -IC:\Geral_Arquivo\Arduino\arduino-1.7.8\libraries\LiquidCrystal\src -IC:\Users\Correia\Documents\Arduino\libraries\USB_Host_Shield_2.0 C:\Users\Correia\AppData\Local\Temp\build7935017195522781359.tmp\Codbar_usb_display.cpp -o C:\Users\Correia\AppData\Local\Temp\build7935017195522781359.tmp\Codbar_usb_display.cpp.o

“ERROS A PARTIR DAQUI:”

In file included from Codbar_usb_display.ino:22:0:
C:\Users\Correia\Documents\Arduino\libraries\USB_Host_Shield_2.0/avrpins.h:21:2: error: #error “Never include avrpins.h directly; include Usb.h instead”
#error “Never include avrpins.h directly; include Usb.h instead”
^
In file included from Codbar_usb_display.ino:23:0:
C:\Users\Correia\Documents\Arduino\libraries\USB_Host_Shield_2.0/max3421e.h:18:2: error: #error “Never include max3421e.h directly; include Usb.h instead”
#error “Never include max3421e.h directly; include Usb.h instead”
^
In file included from Codbar_usb_display.ino:24:0:
C:\Users\Correia\Documents\Arduino\libraries\USB_Host_Shield_2.0/usbhost.h:21:2: error: #error “Never include usbhost.h directly; include Usb.h instead”
#error “Never include usbhost.h directly; include Usb.h instead”
^
In file included from Codbar_usb_display.ino:25:0:
C:\Users\Correia\Documents\Arduino\libraries\USB_Host_Shield_2.0/usb_ch9.h:19:2: error: #error “Never include usb_ch9.h directly; include Usb.h instead”
#error “Never include usb_ch9.h directly; include Usb.h instead”
^
In file included from C:\Users\Correia\Documents\Arduino\libraries\USB_Host_Shield_2.0/Usb.h:27:0,
from Codbar_usb_display.ino:26:
C:\Users\Correia\Documents\Arduino\libraries\USB_Host_Shield_2.0/settings.h:139:155: fatal error: SPI.h: No such file or directory
#include <SPI.h> // Use the Arduino SPI library for the Arduino Due, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available
^
compilation terminated.
Erro ao compilar.

Alguém me pode ajudar?
Muito obrigado

Os erros são bastante claros...

error "Never include avrpins.h directly; include Usb.h instead"

error "Never include max3421e.h directly; include Usb.h instead"

error "Never include usbhost.h directly; include Usb.h instead"

error "Never include usb_ch9.h directly; include Usb.h instead"

Apaga as linhas de include desses ficheiros e esses erros desaparecerão.