a function-definition is not allowed here before '{' token

i have issues compiling the code for my project it will shows (a function-definition is not allowed here before '{' token

i try to change and set the code many times,however, i could not finish sketching the code. could someone help me.

finalcode.ino (6.17 KB)

You are missing a } to close setup() and another at the end of loop().

In fact your {} brackets are in a mess. Try using AutoFormat (Ctrl-T) and that should help. You're continually defining functions inside other functions and that never works. Check that all function definitions start at the far left of the page, no spaces!

Steve

As pointed out, you're missing some }

After an autoformat, every function definition should (basically) start at the beginning of a line; that is, not be indented.

That will point you to the errors; below is your code (a little stripped) that shows the result after the autoformat.

void setup() {
  ...
  ...
  void loop() {
    ...
    ...
    void motor_op(byte LM_dir, byte LM_spd, byte RM_dir, byte RM_spd)