#include <LiquidCrystal.h>
liquidcrystal lcd(12,11,5,4,3,2)
#include <SoftwareSerial.h>
softwareserial myserial(9,10);//9 to Tx of gsm 1oth pin to Rx of gsm
int buttonstate=0;
int analoginput=0;
int f=6;//battery lowlevel
int a=7;//battery full
float vout=0.0;
float vin=0.0;
int value=0;
int pump1=8;//pump on and led indicator on through uln2003
int sensorvalue=A0;//to measure voltage
int moisturesensor=A1;//to measure the moisture level
float R1=6700;
float R2=200;
int count=0
void setup()
{
pinmode(a,OUTPUT);
pinmode(f,OUTPUT);
pinmode(pump 1,OUTPUT);
pinmode (analoginput,INPUT);
lcd.begin(16,2);
myserial.begin(9600);
}
void loop()
{
value=analog read(analog input);
vout=(value5.0)/1024);//measure exact value of voltage if 12v applied it measure 3v
vin=vout/(R2/(R1+R2));//converte 3v into actual battery voltage by multiplying voltage dev rule
//vin=(value(5.0/1023.o)*10);
lcd.setcursor(0,0);
lcd print(input v= )
lcd.setcursor(9,0);
lcd.print(vin,3);
if(vin>12.45)
{
digitalWrite(a,HIGH)
else{digitalWrite(a,LOW);}
if(vin<11.80)
{
digitalWrite(f,HIGH)
else {digitalWrite(f,LOW)};
int sensor value=analog Read(moisture sensor);
serial.print("moisture sensor=");
serial.print(sensor value);
lcd.setcursor(0,1);
lcd.print in("moisture level=");
lcd.setcursor(12,1);
lcd.print(sensor value);
if (sensor>600)
}
lcd setcursor(0,1);
lcd print in("Dry pump on");
serial print in("DRY PUMP ON");
if (count=0)
{send message() }
count=count+1
digitalWrite(pump1,HIGH);//irrigation put on
else if(sensor value<=400)
{
serial.print("wet pump off");
send message();
digitalWrite(pump 1,LOW);irrigation pump off
count=0
}
delay (1000);
}
void send message()
{
myserial.print in("AT+CMGF=1");(2,1)
delay(1000);
myserial.print in("AT+CMGS=+254758089620")
delay(1000);
myserial.print("pump on") the sms u want
delay(1000)