Writing code for DC motor with limit switch

Hi,

I need help with writing a code for a limit switch buttons that controls a DC motor.
The limit switch looks like this:

The DC motor controlled by H-Bridge (L298N) that connected to the Arduino (nano).

I want that the motor will turn right as I push on one button, turn left as I push on the other button and stops as I push on two buttons.

I’m a nooby in this, so I don’t understand much with writing to Arduino.

Thanks a lot!

You need to have a go ! Look at the ide examples for digital Inputs for your limit switches . Look at how to control motors - examples provided with h bridge driver you might use. Write something then get back . Hope this isn’t homework for you ....