/*############################################################################## Author: * Mirko Prosseda (07-2013) * email: mirko.prosseda@gmail.com Description: * Relay Module test sketch v1.0 * Turns on and off the relay every second, driving simultaneously the L LED of the Arduino Connections: * BOARD -> ARDUINO * Vcc -> 5V * GND -> GND * IN -> PIN 12 ##############################################################################*/ // Define constants and variables const int LED = 13; // sets the LED on pin 13 const int RELAY = 12; // set pin 12 ti drive the relay // Initialization void setup(){ pinMode (LED, OUTPUT); // sets pin 13 as digital output pinMode (RELAY, OUTPUT); // sets pin 12 as digital output } // main loop void loop(){ digitalWrite (LED, HIGH); // turn on the led digitalWrite (RELAY, HIGH); // relay activation delay(1000); digitalWrite (LED, LOW); // turn off the led digitalWrite (RELAY, LOW); // relay deactivation delay(1000); }