#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C LCD1(0x27, 20, 4);
void setup() {
Serial.begin(9600); // 시리얼 모니터 출력용
pinMode(A1, INPUT);
LCD1.init(); // LCD 사용 시작
LCD1.backlight(); // LCD 백라이트 켜기
}
void loop() {
//저항 측정 코드
int sensorValue = analogRead(A1); // 아날로그 값 읽기 (0 ~ 1023)
float V_out = sensorValue * (5 / 1023.0); // 읽은 값을 전압으로 변환
float R_unknown = 220 * (V_out / (5 - V_out));
//Serial.println(sensorValue);
LCD1.print(sensorValue);
LCD1.print(", ");
LCD1.print(V_out);
LCD1.print(", ");
LCD1.print(R_unknown);
delay(500);
LCD1.clear();
}