Arduino Code for stepper motor and ultrasonic

I have : Arduino Nano (2 if needed)
HC-SR04 ultrasonic sensor
Stepper motors x2
L298n Motor controllers

I am trying to automate two sliding doors. I would activate this with the ultrasonic sensor. The doors would hit the limit switches (open doors) and then pause till activation comes from the ultrasonic sensor again to close the doors upon hitting the limit sensor on close.

I have made the stepper motors turn but, that is as far as I can get with coding . I am very new to coding, but, been in electronics for awhile .


Why ultrasonic sensors? How do plan to make them do the job? Why not limit swiches?

It sounds as if he proposes to use them as people sensors! :grin:

Good guess. Possible…

To activate the doors with the wave of the hand… I could always just use a push button.

Check out my tutorial on Multi-tasking in Arduino
It has a complete stepper motor example and the its tasked based approach will help you handle multiple i/os

How much is this worth for someone to code ? I am using examples i have found online, but doesn’t seem to work , this doesn’t include the limit switches .

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.