外部スイッチを押してからモーターを3秒間動かしてから停止するという自動制御をしたいのですが、停止させようとしても動き続けてしまいます。PCや外部からの入力を使わず自動で止めるにはどのようにすれば良いのでしょうか?
I want to do automatic control of pushing the external switch and moving the motor for 3 seconds before stopping it, but I will continue to move even if I try to stop it. How can I stop it automatically without using PC or external input?