#include <LiquidCrystal.h> #define echoPin 6 #define initPin 7 unsigned long pulseTime = 0; LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { //Setup LCD lcd.begin(16, 2); pinMode(initPin, OUTPUT); pinMode(echoPin, INPUT); } void loop() { digitalWrite(initPin, HIGH); delayMicroseconds(10); digitalWrite(initPin, LOW); pulseTime = pulseIn(echoPin, HIGH); lcd.setCursor(0,0); lcd.print("Jarak = "); lcd.print(pulseTime / 58, DEC); lcd.print(" cm"); lcd.setCursor(0,1); lcd.print(" rahasia87.blogspot.com"); delay(100); lcd.clear(); }
Artikel ini, di bebaskan untuk copy paste ke blog teman teman, yang penting cantumkan alamat