Addeed comments
This commit is contained in:
parent
e3279375a5
commit
5d66e8b9c0
@ -2,13 +2,18 @@
|
|||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <LiquidCrystal_I2C.h>
|
#include <LiquidCrystal_I2C.h>
|
||||||
|
|
||||||
|
|
||||||
|
// Our LCD Screen uses 0x3F, but replace this for your LCD's adress
|
||||||
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
|
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
|
||||||
|
// Set the first number to the trigger pin, second to echo
|
||||||
NewPing sonar(12,11);
|
NewPing sonar(12,11);
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
// Initializes LCD screen to a 16x2 screen
|
||||||
lcd.begin(16,2);
|
lcd.begin(16,2);
|
||||||
|
|
||||||
|
// Blinks LCD three times, leavig the screen on at the end, easy to see start/restart happened
|
||||||
for(int i = 0; i< 3; i++)
|
for(int i = 0; i< 3; i++)
|
||||||
{
|
{
|
||||||
lcd.backlight();
|
lcd.backlight();
|
||||||
@ -16,15 +21,14 @@ void setup()
|
|||||||
lcd.noBacklight();
|
lcd.noBacklight();
|
||||||
delay(250);
|
delay(250);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcd.backlight();
|
lcd.backlight();
|
||||||
|
|
||||||
|
// Sets the cursor to top left
|
||||||
lcd.setCursor(0,0);
|
lcd.setCursor(0,0);
|
||||||
lcd.print("Distance in cm");
|
lcd.print("Distance in cm");
|
||||||
}
|
}
|
||||||
|
|
||||||
char cm[3];
|
char cm[3];
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
lcd.setCursor(0,1);
|
lcd.setCursor(0,1);
|
||||||
|
Loading…
Reference in New Issue
Block a user