scrap that l298n, it's just junk from an ear long gone. The datasheet says absolute minimum Vs = Vss + 2.5V, so your 7.2V is 0.3v too low to make it work.
thank you, but if I put it in loop then it will kept going, I only need it to go 1 time and then stop.
if I put it in loop then when it hits contact 2 then I start over.
on your simulator its not they I want it to be, I need it to start motor 1 and 2 when the power is on and then it hit contact 1 then motor 1 drive back while motor 2 run's the same way and when it hits concact 2 bouth motor stop and that's it.
i was thinking about if it is the wiring that is wrong, since its not working with the l298n but working with out l298n just uno with led and power board, so I take the 5 volt from uno to the power board, ground to power board were the 2 contacts are plugs in and the 3 led one simulate motor 1 forward 1 for motor 1 bag and motor 3 allows on.
but if I take out the in pins and put on l298n on en1 en2 en3, the power 5 volt from uno to l298n and splits from l298n 5 volt til power board for the concact's and 7,2 v in on l298n its doesn't work.
If it did not work when you used the code and diagram from the tutorial, then I suspect that you have a bad connection or your batteries are dead, or the L298 is bad.
it work with the code from the tutorial, but not my code with l298n, it work with out so I youse led as motors simulation.
can't youse that much from tutorial
i have a item that I want to go forward until it hit a concact"wall" then go back until it hits another concact"wall" there it need to stop motor 1 and 2. there is 2 motor - 1 motor driv the item forward and back while the other motor drive the same way bouth forward and back so always the same way
I did not write the entire code for you. The code I gave you has all the basic functions you need to do what you want. You will have to figure out how to do the switching part yourself.
Hint:
When you call Forward() the direction_X varaible will equal Dir_Forward
When you call Back() the direction_X varaible will equal Dir_Back
Use the direction_X varaible and the contact1,2 variable to figure out what to do next