'Joystick'was not declared in this scope

Hi, I'm kinda newbie and I need help. I got the error 'Joystick'was not declared in this scope, to be precise:

C:\Users\piotr\Desktop\Analog-E-Brake-master\ANALOG_EBRAKE\ANALOG_EBRAKE.ino: In function 'void setup()':

ANALOG_EBRAKE:13: error: 'Joystick' was not declared in this scope

Joystick.begin();}

^

C:\Users\piotr\Desktop\Analog-E-Brake-master\ANALOG_EBRAKE\ANALOG_EBRAKE.ino: In function 'void loop()':

ANALOG_EBRAKE:21: error: 'Joystick' was not declared in this scope

{Joystick.setThrottle(mapped);}}

^

exit status 1
'Joystick' was not declared in this scope

Sketch:

#include <Joystick.h>

void setup()

{pinMode(A0, INPUT);
Joystick.begin();}

const int pinToButtonMap = A0;

void loop()

{int pot = analogRead(A0);
int mapped = map(pot,0,1023,0,255);
{Joystick.setThrottle(mapped);}}

I downloaded this from one guy tutorial. For everyone it works, but not for me. what should I do?

I do not see where you declare a Joystick object. Look at the examples that come with the Joystick library. There needs to be a line like

// create joystick
Joystick_ Joystick;

in your code.

You are awesome! Thanks man!