Lpdc
Lpdc
Lpdc
/////////Lpdc/////////
https://arduino-info.wikispaces.com
*/
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define trigPin 12
#define echoPin 10
//Parameter below refer to: Addr, En, Rw, Rs, d4, d5, d6, d7
//Most displays use I2C Adress 0x27 but a FEW (Including those labelled "MH" ) use 0x3F (Need to be
changed in code).
float duration;
int distance;
void setup() {
/*
*/
Serial.begin(9600);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
Serial.println(distance);//TEST!
lcd.setCursor(0,0); // Set cursor to the begin of 1st line, also possible with lcd.home()
}else{
lcd.clear();
lcd.setCursor(0,0); // Set cursor to the begin of 1st line, also possible with lcd.home()
lcd.print(" cm");