Mega 2560 hid joystick hoodloader2

All probably know the library hoodloader2 from NicoHood. I installed correctly on the arduino mega 2560. In device Manager correctly displayed. The question how to use arduino mega for the buttons on the hid device example ?

I'm still waiting for help! I scribbled a little code, but I don't really like it. It is impossible to press 2 buttons . How correctly to transfer in serial ?

//16u2

include "HID-Project.h"

void setup() {

Serial1.begin(250000); Gamepad.begin(); Serial.begin(250000);

}

void loop() { char q = Serial1.read();

if (q == 'q') { Gamepad.press(1); Serial.println('q'); }

else

{

Gamepad.release(1); }

char w = Serial1.read();

if (w == 'w') { Gamepad.press(2); Serial.println('w'); }

else

{

Gamepad.release(2); }

char e = Serial1.read();

if (e == 'e') { Gamepad.press(3); Serial.println('e'); }

else

{

Gamepad.release(3); }

//mega2560

const int buttonPin2 = 2; const int buttonPin3 = 3; const int buttonPin4 = 4; const int buttonPin5 = 5; const int buttonPin6 = 6;

int buttonState2 = 0; int buttonState3 = 0; int buttonState4 = 0; int buttonState5 = 0; int buttonState6 = 0;

void setup() {

pinMode(buttonPin2, INPUT_PULLUP); pinMode(buttonPin3, INPUT_PULLUP); pinMode(buttonPin4, INPUT_PULLUP); pinMode(buttonPin5, INPUT_PULLUP); pinMode(buttonPin6, INPUT_PULLUP);

Serial1.begin(250000); Serial.begin(250000); }

void loop() {

buttonState2 = digitalRead(buttonPin2); buttonState3 = digitalRead(buttonPin3); buttonState4 = digitalRead(buttonPin4); buttonState5 = digitalRead(buttonPin5); buttonState6 = digitalRead(buttonPin6);

if (buttonState2 == LOW) {

Serial.write('q'); }

if (buttonState3 == LOW) {

Serial.write('w'); }

if (buttonState4 == LOW) {

Serial.write('e'); }

if (buttonState5 == LOW) {

Serial.write('r'); }

if (buttonState6 == LOW) {

Serial.write('t'); }

}