Direct command to Arduino

Hello to all I am new to arduino and i would like to know if it is possible to use it to connect 2 5v relais to it and open/close them by direct commands . TIA

Depends on the relays. If the relay coil current is less than 40mA, then, digitalWrite(relayPin, HIGH) will activate the relay.

If the relay coil current is greater than 40mA, you'll need a transistor that the Arduino can turn on, that will in turn pass current to the relay.

Thanks for your reply, The relais are simple 5v dc relais . Could you advise where to look up for direct commands ?


You haven't answered the key question of how much current does you 5vdc relay coil draw. That determines how you would wire the relays to the Arduino.

As far as how you would control them in software, it's pretty simple.

In the setup portion of your code you would progam two I/O pins to be output mode. Then in your loop code you would use a digialWrite() command to either turn on or off the pin anytime you want.