Hello everyone, I am new to this world of programming, I might know how to use it with Mobiflight and arduino mega2560 to use the spoiler lever, either with a potentiometer or with micro swich

I have already configured with mobiflight and arduino, the landing gear lever and the led and everything is perfect, but I can not manage to assign the spoilers nor with what element I can do it either with a potensiometer or with a micro swich
If someone could help me solve my problem I would appreciate it
I have tried to configure with Arduino mega 2560, as it says a tutorial of mobiflight assigning as joystick in arduino but I get an error when wanting to validate the code that fasilitan in the tutorial, the code is this:
//Create Joystick
Joystick_ Joystick;
Be sure to download the Joystick library from https://github.com/MHeironimus/ArduinoJoystickLibrary
Here is the full code to copy and paste.
#include <Joystick.h>
// Create Joystick
Joystick_ Joystick;
unsigned int xAxis = 0;
unsigned int yAxis = 0;
unsigned int zAxis = 0;
// Set "initAutoSendState" to true for "Auto Send" mode or false for "Manual Send" mode.
const bool initAutoSendState = true;
void setup() {
Joystick.begin();
}
void loop() {
xAxis = analogRead(A0)/4;
xAxis = map(xAxis,0,255,-127,127);
yAxis = analogRead(A1)/4;
yAxis = map(yAxis,0,255,-127,127);
zAxis = analogRead(A2)/4;
zAxis = map(zAxis,0,255,-127,127);
Joystick.setXAxis(xAxis);
Joystick.setYAxis(yAxis);
Joystick.setZAxis(zAxis);
//Joystick.setState(); //this updates the "Joystick" library
//and therefore your computer of all the current
//joystick and button states determined above
//all at once. YOU ONLY NEED TO USE THIS LINE
//IF const bool initAutoSendMode = FALSE (the
//code for the initAutoSendState is a few
//lines above the "setup" section of code.
}
but wanting to load it I get this error:
Arduino:1.8.7 (Windows 7), Tarjeta:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
In file included from E:\Mis documentos\Arduino\sketch_nov12a\sketch_nov12a.ino:18:0:
E:\Mis documentos\Arduino\libraries\Joystick\src/Joystick.h:32:2: error: #error The Joystick library can only be used with a USB MCU (e.g. Arduino Leonardo, Arduino Micro, etc.).
#error The Joystick library can only be used with a USB MCU (e.g. Arduino Leonardo, Arduino Micro, etc.).
^
Se encontraron múltiples librerías para "Joystick.h"
Usado: E:\Mis documentos\Arduino\libraries\Joystick
No usado: C:\Program Files (x86)\Arduino\libraries\Joystick
exit status 1
Error compilando para la tarjeta Arduino/Genuino Mega or Mega 2560.
Este reporte podría tener más información con
"Mostrar salida detallada durante la compilación"
opción habilitada en Archivo -> Preferencias.
I'm a big fan of flight simulation, and I like to learn as well as spread my knowledge with whoever needs them.