From 5d66e8b9c0f2b8245981c5e7646a8e529ab6bc09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Thu, 14 Apr 2016 10:07:54 +0200 Subject: [PATCH] Addeed comments --- School/vg1/Dataelektronikk/Ultrasonic Distance.ino | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/School/vg1/Dataelektronikk/Ultrasonic Distance.ino b/School/vg1/Dataelektronikk/Ultrasonic Distance.ino index 42dd601..c6d603d 100644 --- a/School/vg1/Dataelektronikk/Ultrasonic Distance.ino +++ b/School/vg1/Dataelektronikk/Ultrasonic Distance.ino @@ -2,13 +2,18 @@ #include #include + +// 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); +// Set the first number to the trigger pin, second to echo NewPing sonar(12,11); void setup() { + // Initializes LCD screen to a 16x2 screen 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++) { lcd.backlight(); @@ -16,15 +21,14 @@ void setup() lcd.noBacklight(); delay(250); } - lcd.backlight(); + // Sets the cursor to top left lcd.setCursor(0,0); lcd.print("Distance in cm"); } char cm[3]; - void loop() { lcd.setCursor(0,1);