Hi, I'm not good in English but I want to ask help for my research project. My project is door controlled by ultrasonic sensor. I need a code for ultrasonic sensor with stepper motor. It starts from open. When sensor detect an object the door will close and stop, and if sensor does not detect anything, the door will open and stop.
I'm using an Arduino Uno, nema 17 stepper motor and L298n motor driver.
Please help me for code
and then combine them with the logic in the state change detection.
If you can make the parts work separately, that solves lots of problems. Then adjust the connections/pin numbers so they work attached to the same board at the same time with different sketches, that solves the next level of problems. Then you need to work out the logic to make them interact properly within one sketch.
To add to @DaveX 's suggestion, you should get each one working by itself then when you have all them working you can combine them into your final sketch.