Toll-Free Customer Support 24/7

single arduino code

/*
* Project name:
Single Relay Board 12v
* Copyright
(c) Researchdesignlab.com
* Description:

* Test configuration:
MCU: ATMEGA328
Dev.Board: Arduino uno
Oscillator: 16 MHz
Software: Arduino

*/
#include <LiquidCrystal.h> // initialize the library with the numbers of the

LiquidCrystal lcd(6, 7, 2, 3, 4, 5);
/*
* LCD RS pin to digital pin 6
* LCD Enable pin to digital pin 7
* LCD D4 pin to digital pin 2
* LCD D5 pin to digital pin 3
* LCD D6 pin to digital pin 4
* LCD D7 pin to digital pin 5
* LCD R/W pin to ground */

int rel=8; //connect relay pin pin no. 8 of ardoino

void setup()
{
lcd.begin(16, 2); // set up the LCD's number of columns and rows:
pinMode(rel,INPUT);
}

void loop()
{
lcd.clear();
digitalWrite(rel,HIGH);
lcd.print("rel on"); // Print a message to the LCD.
delay(500);
lcd.clear();
digitalWrite(rel,LOW);
lcd.print("rel off"); // Print a message to the LCD.
delay(500);
}

Back to top