Skip to content

Instantly share code, notes, and snippets.

@yemreeke
Created May 1, 2021 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yemreeke/bac45ce27b2109780bc6538ec36e9665 to your computer and use it in GitHub Desktop.
Save yemreeke/bac45ce27b2109780bc6538ec36e9665 to your computer and use it in GitHub Desktop.
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
float VoltajCikis = 0.0;
float VoltajGiris = 0.0;
float Direnc1 = 100000.0; // 100K ohm direnç
float Direnc2 = 10000.0; // 10K ohm direnç
int Deger = 0;
void setup() {
lcd.begin();
}
void loop() {
Deger = analogRead(A0);
VoltajCikis = (Deger * 5.0) / 1024.0;
VoltajGiris = VoltajCikis / (Direnc2 / (Direnc1 + Direnc2));
if (VoltajGiris < 0.09) {
VoltajGiris = 0.0;
}
lcd.setCursor(2, 0);
lcd.print("Voltaj=");
lcd.print(VoltajGiris);
lcd.print("V");
lcd.setCursor(3, 1);
lcd.print("BlueGrays");
delay(300);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment