CODE for ARDUINO LCD-UART:]
#include <LiquidCrystal.h>
int pumppin1 = 13; // pin 2 on L293D IC
int enablePin = 11; // pin 1 on L293D IC
int state;
int flag=0; //makes sure that the serial only
prints once the state
// Configuring the LCD
LiquidCrystal lcd(2,3,4,5,6,7,8); //lcd(rs,rw,en,d0,d1,d2,d3,d4,d5,d6,d7)
void setup()
{
lcd.begin(16,2);
pinMode(pumppin1, OUTPUT);
pinMode(enablePin, OUTPUT);
// initialize serial communication at 9600 bits per second
Serial.begin(9600);
}
void LCD-WRITE-MESG()
{
lcd.setCursor(0,0);
lcd.print(“pump system”);
}
Read-mast-Reqst-and-Act()
(
// Read request from the Master
if(Serial.available() > 0)
{
state = Serial.read();
flag=0;
}
// if the state is ‘0’ the PUMP PIN will be turned off
if (state == ‘0’)
{
digitalWrite(PumpPin1, LOW); // set pin 2 on L293D low
if(flag == 0)
{
flag=1;
lcd.setCursor(0,1);
lcd.print(“motor: off”);
}
}
// if the state is ‘1’ the Pump will be turn on
else if (state == ‘1’)
{
digitalWrite(PumpPin1, HIGH);
if(flag == 0)
{
flag=1;
lcd.print(“motor: on”);
}
}
// Indefinite loop for processing the Master request and taking up the actuating function
loop()
{
Read-mast-Reqst-and-Act(;
delay(100);
}