Controled motor DC 12V turn on/of by IR sensor

Hi guys,
I solving simple problem I think, but my skills with Arduino code are not good. My idea is that I have Arduino UNO, IR optical sensor (TCST2300), DC motor 12V, relay and I want switching motor by optical sensor. I need to turn on the motor (relay) object in the optical sensor for 5 seconds and after turn of automatically by code
I will be happy for any help. I believe the code is very simple, I just have no idea how to say arduino delay to leave the engine on and off after the timer.

Thanx!

Hello,
study the BLINKWITHOUTDELAY example of the IDE.
Have a nice day and enjoy coding in C++.

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