Simulasi Rangkaian DC Voltmeter menggunakan LCD 16x2 berbasis Arduino
Skematik Rangkaian
Sketch atau Program Arduino
#include
<LiquidCrystal.h>
LiquidCrystal
lcd(12, 11, 5, 4, 3, 2);
int
analogInput = 0;
float
vout = 00.0;
float
vin = 00.0;
float
R1 = 100000.0;
float
R2 = 100000.0;
int
value = 0;
void
setup(){
pinMode(analogInput, INPUT);
lcd.begin(16, 2);
lcd.print("DC VOLTMETER");
}
void
loop(){
value = analogRead(analogInput);
vout = (value * 5.0) / 1024.0;
vin = vout / (R2/(R1+R2));
if (vin<1){
vin=1;
}
lcd.setCursor(0,
1);
lcd.print("INPUT
= ");
lcd.print(vin);
lcd.print("
V");
delay(500);
}
Video Simulasi
Komentar
Posting Komentar