Programming Questions / L298N Driver - Code Issuing - " expected primary-expression before '=' token" Today at 07:20 pm Hello Arduino Community,

Code is shown at bottom - please read below

I've been working on a little project that uses the L298N Dual Motor Driver to run a single motor.

Using this link I set up my project (disregard Using the L298N with PIC Section) :


  1. I connected my wires and checked them and their connections for any problems.

  2. I am using 1 motor instead of two

  3. I am using two 'C' Duracell Alkaline Batteries, connected them together in a series circuit. I've tested the batteries and they run my Small Round Electric Motor with 12000 RPM + 3 to 6V DC perfectly when I don't connect the battery and motor to the L298N Driver.

  4. The two, 'C' batteries are 1.5 volts each (connecting them together in series give me 3 volts)

  5. I am connecting my arduino uno to a newly purchase laptop - I've compiled codes from this computer that have worked fine.

I copied and pasted the code from the website at the link at the top. I checked device manager and chose the correct port with the correct board, so I am starting to believe there is something wrong with the code on the website.

Once I compile the program, errors pop up stating, "expected primary-expression before '=' token" for every line of code that has a #defined variable (mentioned on the top lines of the program).

It would be helpful to please comment your thoughts and solutions for this issue.

Please see link at the top for code.

Thank you.

  • when a sketch fails to compile, it has nothing to do with the hardware itself ... you only need to select the correct board before compiling, but it does not need to be connected for the sketch to compile ... connection to the board is only necessary during the upload phase after compilation is successful ... that means that all of the information that you included about batteries and motors is irrelevant to your question – jsotola Dec 30 '19 at 20:30

Definitions via #define don't use equal signs. The following is wrong

#define EN = 1

Instead it should be

#define EN 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.