flowchart ULTRASONIC RANGE METER
/*-----------------------------------------------------
' APLIKASI 1
' ULTRASONIC RANGE METER
' TRIG --> Pin 8
' ECHO --> Pin 9
' Hasilnya tampilkan ke LCD
'
'------------------------*/
#define ECHOPIN 9
#define TRIGPIN 8
#include <LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7);
unsigned int jarak, timer;
void setup(){
lcd.begin(16, 2);
lcd.print(" ULTRASONIC");
lcd.setCursor(0, 1);
lcd.print(" RANGE METER");
delay(2000);
lcd.clear();
lcd.print("Range=");
pinMode(ECHOPIN, INPUT);
pinMode(TRIGPIN, OUTPUT);
}
void loop(){
digitalWrite(TRIGPIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIGPIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGPIN, LOW);
timer = pulseIn(ECHOPIN, HIGH);
jarak= timer/58;
lcd.setCursor(6, 0);
lcd.print(jarak);
lcd.print(" cm ");
delay(1000);
}
Related Posts
arduino: mottion following using 2 ultrasonic sensor
#include <Servo.h> #include <LiquidCrystal.h> LiquidCrystal lcd(2,3,4,5,6,7); Servo m[...]25Jan2016
volume control tangki air arduino
flowchart programnya..... /*----------------------------------------------------- ' [...]23Oct2015
tongkat tunatentra ultrasonik arduino
flowchart programnya............... /*----------------------------------------------------- '[...]22Oct2015
kran otomatis arduino dan ultrasonik
flowchart programnya......... /*----------------------------------------------------- ' [...]22Oct2015
penghitung jumlah orang otomatis pake arduino
flowchart /*----------------------------------------------------- ' ' PEN[...]22Oct2015
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.