Perancangan Sistem Pengukuran Suhu Tanpa Menyentuh Objek Dengan Memanfaatkan Sensor Infrared Berbasis Arduino Uno
Lampiran program lengkap
#include "pitches.h"
#include
#include
#include
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
LiquidCrystal lcd(7,6,5,4,3,2);
int jarak;
float jauh;
int data, tombol;
int jrk;
// notes in the melody:
int melody[] = {
NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3,
NOTE_C4
};
// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
4, 8, 8, 4, 4, 4, 4, 4
};
void setup() {
pinMode(A3,OUTPUT);
pinMode(8,INPUT);
50
Universitas Sumatera Utara
Lampiran rangkaian lengkap
49
Universitas Sumatera Utara
digitalWrite(8, HIGH);
lcd.begin(16, 2);
lcd.print("
WELCOME
");
delay(100);
for (int thisNote = 0; thisNote < 8; thisNote++) {
int noteDuration = 300 / noteDurations[thisNote];
tone(13, melody[thisNote], noteDuration);
int pauseBetweenNotes = noteDuration * 2.5;
delay(pauseBetweenNotes);
noTone(13);
mlx.begin();
}
}
void loop() {
//
lcd.print("Ambient
=");lcd.print(mlx.readAmbientTempC());
tombol=digitalRead(8);
lcd.clear();
jarak=analogRead(0);
jauh=(jarak*0.004887)/4.5;
jrk=jauh*100;
data=(0.4-jauh)*10;
if (jauh0.5 && tombol==0)
{
digitalWrite(A3,LOW);
lcd.setCursor(0, 0);
lcd.print("
Range OUT
");
}
else if (tombol==1)
{
digitalWrite(A3,LOW);
lcd.setCursor(0, 0);
lcd.print("Tekan untuk tmbl");
lcd.setCursor(0, 1);
lcd.print("Mengukur suhu");
}
delay(500);
}
52
Universitas Sumatera Utara
#include "pitches.h"
#include
#include
#include
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
LiquidCrystal lcd(7,6,5,4,3,2);
int jarak;
float jauh;
int data, tombol;
int jrk;
// notes in the melody:
int melody[] = {
NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3,
NOTE_C4
};
// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
4, 8, 8, 4, 4, 4, 4, 4
};
void setup() {
pinMode(A3,OUTPUT);
pinMode(8,INPUT);
50
Universitas Sumatera Utara
Lampiran rangkaian lengkap
49
Universitas Sumatera Utara
digitalWrite(8, HIGH);
lcd.begin(16, 2);
lcd.print("
WELCOME
");
delay(100);
for (int thisNote = 0; thisNote < 8; thisNote++) {
int noteDuration = 300 / noteDurations[thisNote];
tone(13, melody[thisNote], noteDuration);
int pauseBetweenNotes = noteDuration * 2.5;
delay(pauseBetweenNotes);
noTone(13);
mlx.begin();
}
}
void loop() {
//
lcd.print("Ambient
=");lcd.print(mlx.readAmbientTempC());
tombol=digitalRead(8);
lcd.clear();
jarak=analogRead(0);
jauh=(jarak*0.004887)/4.5;
jrk=jauh*100;
data=(0.4-jauh)*10;
if (jauh0.5 && tombol==0)
{
digitalWrite(A3,LOW);
lcd.setCursor(0, 0);
lcd.print("
Range OUT
");
}
else if (tombol==1)
{
digitalWrite(A3,LOW);
lcd.setCursor(0, 0);
lcd.print("Tekan untuk tmbl");
lcd.setCursor(0, 1);
lcd.print("Mengukur suhu");
}
delay(500);
}
52
Universitas Sumatera Utara