Perancangan Frekuensi Meter Osilator IC LM555 Berbasis Arduino Nano

Lampiran A
Program Keseluruhan dari sistem
#include "Timer.h"
#include

LiquidCrystal lcd(6, 7, 9, 10, 11, 12);

Timer t;
int count = 0;

void setup() {
// put your setup code here, to run once:
lcd.begin(16, 2);
lcd.print("TUGAS AKHIR");
lcd.setCursor(0,1);
lcd.print("INDRA KHARISMA");
delay(1000);
Serial.begin(9600);
attachInterrupt(0, ISR_clock, FALLING);
t.every(1000,takeReading);
}


void loop() {

20
Universitas Sumatera Utara

// put your main code here, to run repeatedly:
t.update();
}

void takeReading()
{
lcd.clear();
Serial.print("Freq = ");

float freq = count;
Serial.println(freq);
lcd.setCursor(0,0);
lcd.print("frekuensi :");
lcd.setCursor(0,1);

lcd.print(freq/2);
lcd.setCursor(4,1);
lcd.print("Hz");
count=0;
}
void ISR_clock()
{
count++;
}

21
Universitas Sumatera Utara