50
Lampiran program lengkap
#include "pitches.h"
#include <LiquidCrystal.h> #include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614(); LiquidCrystal lcd(7,6,5,4,3,2);
int jarak; float jauh;
int data, tombol; int jrk;
// 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);
49
Lampiran rangkaian lengkap
51 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); tombol=digitalRead(8);
lcd.clear();
jarak=analogRead(0);
52 digitalWrite(A3,HIGH); lcd.setCursor(0, 1); lcd.print("Object= ");