LCD 20×4 DC Voltage & Amp Arduino Sensor

Nyimpen script daripada hilang … ini adalah script monitoring tegangan dan arus dc menggunakan sensor rakitan … dapat di beli di ana juga hehehe .. nyimpen data dulu nanti sambung nulis ne ngoahahah

//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 20 chars and 4 line display

int analogInput = A0;
float vout0 = 0.0;
float vin0 = 0.0;
float R1 = 20000.0; //
float R2 = 1200.0; //
int value = 0;

int analogInput1 = A2;
float vout1 = 0.0;
float vin1 = 0.0;
float R3 = 20000.0; //
float R4 = 1200.0; //
int value1 = 0;

int analogInput2 = A6;
float vout2 = 0.0;
float vin2 = 0.0;
float R5 = 20000.0; //
float R6 = 1200.0; //
int value2 = 0;

void setup()
{
pinMode(analogInput, INPUT);
lcd.init(); // initialize the lcd
lcd.init(); // Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0,0);
lcd.print(“VOLTAGE METER”);
lcd.setCursor(0,1);
lcd.print(“Volt1 =”);
lcd.setCursor(0,2);
lcd.print(“Volt2 =”);
lcd.setCursor(0,3);
lcd.print(“Volt2 =”);
}

void loop()
{
value = analogRead(analogInput);
vout0 = (value * 5.0) / 1024.0; // see text
vin0 = vout0 / (R2/(R1+R2));
lcd.setCursor(7,1);
lcd.print((vin0));
delay(500);

value1 = analogRead(analogInput1);
vout1 = (value1 * 5.0) / 1024.0; // see text
vin1 = vout1 / (R4/(R3+R4));
lcd.setCursor(7,2);
lcd.print((vin1));
delay(500);

value2 = analogRead(analogInput2);
vout2 = (value2 * 5.0) / 1024.0; // see text
vin2 = vout2 / (R6/(R5+R6));
lcd.setCursor(7,3);
lcd.print((vin2));
delay(500);
}

Tinggalkan Komentar

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

This site uses Akismet to reduce spam. Learn how your comment data is processed.