#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address (You can find this using I2C scanner or check your LCD datasheet)
#define I2C_ADDR 0x27

// Set the LCD dimensions
#define LCD_COLUMNS 16
#define LCD_ROWS 2

// Create an instance of the LiquidCrystal_I2C library
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_ROWS);

// Define the pin to which your IC is connected
const int icPin = 2; // Change this to the actual pin number

void setup() {
  Serial.begin(9600);
  
  // Initialize the LCD
  lcd.begin(LCD_COLUMNS, LCD_ROWS);
  lcd.setBacklight(HIGH); // HIGH to turn on backlight, LOW to turn it off

  lcd.print("IC Testing");
  delay(2000);
  lcd.clear();
}

void loop() {
  // Read the state of the IC pin
  int icState = digitalRead(icPin);

  // Display the result on the LCD
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("IC State: ");
  lcd.setCursor(0, 1);
  lcd.print(icState == HIGH ? "Working" : "Not Working");

  delay(1000); // Wait for a moment before the next reading
}