#include <LiquidCrystal.h>
// Initialize the LCD with the appropriate pins
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
const int analogPin = A0;
const int digitalPin = 8;
void setup() {
lcd.begin(16, 2); // Initialize the LCD with 16 columns and 2 rows
lcd.setCursor(0, 0);
lcd.print("Ohm Meter");
pinMode(digitalPin, OUTPUT);
digitalWrite(digitalPin, LOW); // Set the digital pin LOW initially
}
void loop() {
digitalWrite(digitalPin, HIGH); // Apply 5V to the resistor
delay(10); // Allow the voltage to stabilize
int rawValue = analogRead(analogPin); // Read the analog voltage
digitalWrite(digitalPin, LOW); // Turn off the voltage source
// Calculate resistance using the voltage divider formula
float voltage = (5.0 * rawValue) / 1023.0;
float resistance = (10.0 * voltage) / (5.0 - voltage);
lcd.setCursor(0, 1);
lcd.print("Resistance: ");
lcd.setCursor(12, 1);
lcd.print(resistance, 2); // Display resistance with 2 decimal places
lcd.print(" Ohms ");
delay(1000); // Delay before taking another reading
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
pot1:GND
pot1:SIG
pot1:VCC
lcd1:VSS
lcd1:VDD
lcd1:V0
lcd1:RS
lcd1:RW
lcd1:E
lcd1:D0
lcd1:D1
lcd1:D2
lcd1:D3
lcd1:D4
lcd1:D5
lcd1:D6
lcd1:D7
lcd1:A
lcd1:K
r1:1
r1:2
r2:1
r2:2