expected unqualified-id before '.' token

Trying to Verify/Upload Sketch " Analog E-Brake " by :Amstudio and Getting The Error :expected unqualified-id before ‘.’ token

Equipment - Pro Micro

Code as Follows :

// Analog eBrake-Handbrake
// PIN A0 to 10k pot output - Throttle Axis
// Use with Arduino ProMicro.
// Tested and working in DiRT RALLY + ASSETTO CORSA
// by AMSTUDIO
// 20.1.2017

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

{Joystick.setThrottle(mapped);}} <<<<<< this line becomes Highlighted after Error comes up

Thanks for your time and Any Help…

If you look at the examples that come with the library, you will notice an important part that you missed. After including the library, you have to create an object of type Joystick_

// Create Joystick
Joystick_ Joystick;

The IDE has a really useful control to allow you to copy all of the error message.

Sorry i thought what i posted was the Error Msg

Arduino: 1.8.13 (Windows 10), Board: “Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)”

C:\Users\user\AppData\Local\Temp\ExpressZip-12472-2\Analog-E-Brake-master (4).zip\Analog-E-Brake-master\ANALOG_EBRAKE\ANALOG_EBRAKE.ino: In function ‘void setup()’:

ANALOG_EBRAKE:13:12: error: expected unqualified-id before ‘.’ token

Joystick.begin();}

^

C:\Users\user\AppData\Local\Temp\ExpressZip-12472-2\Analog-E-Brake-master (4).zip\Analog-E-Brake-master\ANALOG_EBRAKE\ANALOG_EBRAKE.ino: In function ‘void loop()’:

ANALOG_EBRAKE:21:10: error: expected unqualified-id before ‘.’ token

{Joystick.setThrottle(mapped);}}

^

Multiple libraries were found for “Joystick.h”

Used: C:\Users\user\Documents\Arduino\libraries\Joystick

Not used: D:\Arduino\libraries\Joystick

Not used: C:\Users\user\Documents\Arduino\libraries\AxisJoystick

exit status 1

expected unqualified-id before ‘.’ token

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

OK …i just literally did step for step from a YouTube video…on doing this brake…guy Downloaded the Github file…Added Joystick file to library …then opened the Sketch verified it and uploaded it Exactly as the code is…that is whats got me stumped…so as to were to put the code you are referring to im LOST…im still just tinkering with learning the code that is why i was glad to see there was Code for it already but to my surprise it didn’t work like the Video

materialmanx:
so as to were to put the code you are referring to im LOST...im still just tinkering with learning the code that is why i was glad to see there was Code for it already but to my surprise it didn't work like the Video

In the IDE, go to File->examples->Joystick->... and open any of the example. Look at the code. Try compiling the code. Try uploading the code. Try incorporating what you have learned/observed into your code.

I am confident you can figure out where to put the object declaration if you try.