Troubleshouting my sketch

Hi, sorry if I'm not posting in the right place, this is my first post. I'm trying to create a simple button box, for games like elite dangerous. I've already managed to use the same sketch for another project, but now I can't. I always get the same error when I verify the sketch: dod_button_box_code_v3:62:1: error: expected declaration before '}' token

}

^

exit status 1

expected declaration before '}' token

If someone can help me it would be great

Here is the original code :

`

#include <Keypad.h>
#include <Joystick.h>

//DEFINITIONS
#define ENABLE_PULLUPS
#define NUMBUTTONS 17 //replace "?"with number of buttong you are using
#define NUMROWS 4 //replace "?" with number of rows you have
#define NUMCOLS 5 //replace "?" with number of columns you have

//BUTTON MATRIX
//first change number of rows and columns to match your button matrix, 
//then replace all "?" with numbers (starting from 0)
byte buttons[NUMROWS][NUMCOLS] = {
  {0,1,2,3,4},
  {5,6,7,8},
  {9,10,11,12},
  {13,14,15,16}
  
 
 
};

struct rotariesdef {
  byte pin1;
  byte pin2;
  int ccwchar;
  int cwchar;
  volatile unsigned char state;
};

//BUTTON MATRIX PART 2
byte rowPins[NUMROWS] = {1,2,3,4}; //change "?" to the pins the rows of your button matrix are connected to
byte colPins[NUMCOLS] = {12,11,10,9,8}; //change "?" to the pins the rows of your button matrix are connected to

Keypad buttbx = Keypad( makeKeymap(buttons), rowPins, colPins, NUMROWS, NUMCOLS);

//JOYSTICK SETTINGS
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,
  JOYSTICK_TYPE_JOYSTICK,
  32, //number of buttons
  0, //number of hat switches
  //Set as many axis to "true" as you have potentiometers for
  false, // y axis
  false, // x axis
  false, // z axis
  false, // rx axis
  false, // ry axis
  false, // rz axis
  false, // rudder
  false, // throttle
  false, // accelerator
  false, // brake
  false); // steering wheel

const int numReadings = 20;
 
int readings[numReadings];      // the readings from the analog input
int index = 0;              // the index of the current reading
int total = 0;                  // the running total
int currentOutputLevel = 0;
 
}

`

Welcome to the Forum! Read the forum guidelines to see how to properly ask a question and some good information on making a good post. You will get faster and better help if you post all your code as requested by the forum guidelines.
Please go back and fix your original post.

Also please take sure that you shown whole sketch. The code you posted not looks complete.

Welcome to the forum

You do not have setup() or loop() function in your sketch and you have a closing } at the end of it with no matching open {

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.