Updatedreceiver

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

#include <SoftwareSerial.

h>
#include<LiquidCrystal.h>
SoftwareSerial GSerial(2,12);
LiquidCrystal lcd(4,5,6,7,8,9);
unsigned long c_t=0;
unsigned long s_t=0;
unsigned int t0;
unsigned int long t=0;

void setup() {
lcd.begin(16,2);
lcd.cursor();
pinMode(11,INPUT);
Serial.begin(9600);
GSerial.begin(400);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(" LiFi - Wireless");
lcd.setCursor(0, 1);
lcd.print(" Communication ");
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" using Light ");
lcd.setCursor(0, 1);
lcd.print(" Receiver ");
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" BY Batch2");
lcd.setCursor(0, 1);
lcd.print(" Team 4");
delay(1000);
lcd.clear();
}
void loop()
{
t=pulseIn(11,HIGH,2000000)/1000;
t=t-t%100;
Serial.print("Value of t:");
Serial.println(t);//for test with serial monitor 33
Serial.println(t%100);

if(t==100)
{ lcd.setCursor(0,0);
lcd.print("Message:");
lcd.setCursor(0,1);
lcd.print("Apply Brakes");
delay(1000);
lcd.clear();
}

if(t==200)
{lcd.setCursor(0,0);
lcd.print("Message:");
lcd.setCursor(0,1);
lcd.print("Drive safe");
delay(1000);
lcd.clear();}
}

You might also like