Tugas Pendahuluan Modul II : Pengujian Sensor Ultrasonic dan ditampilkan di LCD
DAFTAR ISI
1. Kondisi
2. Gambar rangkaian simulasi
3. Flowchart
4. Listing Program
5. Video Simulasi
6. Link download
1. Kondisi [menuju awal]
2. Gambar Rangkaian Simulasi [menuju awal]
3. Flowchart [menuju awal]
4. Listing Program [menuju awal]
#include <LiquidCrystal.h>
#define echoPin 21
#define trigPin 20
long ping;
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
void setup() {
// put your setup code here, to run once:
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("PRAKTIKUM");
delay(50);
lcd.clear();
lcd.print("MIKROPROSESSOR");
delay(50);
lcd.clear();
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
ping = pulseIn(echoPin, HIGH);
lcd.setCursor(0,0);
lcd.print("Ping = ");
lcd.setCursor(7,0);
lcd.print(ping);
delay(100);
lcd.clear();
}
Tidak ada komentar:
Posting Komentar