programing part for petrol level measuring in tamil
this is coding part for petrol measuring project.How the codes are working and how is run.All details are told in this video.This is fully tamil video.So you will learn easily.
code for this project
#define trig 5
#define echo 6
#include <LiquidCrystal.h>
LiquidCrystal LCD(8,9,10,11,12,13); //(en ,rs,d0,d1,d2,d3)
void setup() {
Serial.begin(9600);
LCD.begin(16,2);
pinMode(trig,OUTPUT);
pinMode(echo,INPUT);
pinMode(13,OUTPUT);
pinMode(4,OUTPUT);
digitalWrite(4,HIGH);
}
void loop() {
digitalWrite(trig,LOW);
delay(2);
digitalWrite(trig,HIGH);
delay(2);
digitalWrite(trig,LOW);
long t= pulseIn(echo,HIGH);
float cm=t/29/2;
LCD.setCursor(0,0);
LCD.print("petrollevel:");
LCD.setCursor(12,0);
LCD.print(24-cm);
LCD.setCursor(14,0);
LCD.print("cm");
float WL,lits;
WL = 24 - cm;
lits = (3.14 * 49 * WL)/1000 ;//1 cm cube is equal to 1 ml..
Serial.println(lits);
LCD.setCursor(0,1);
LCD.print("petrol Ltrs");
LCD.print(lits);
delay(1000);
}
Comments
Post a Comment