/* ATtiny44/84 I2C pins: ATtiny Pin 5 = SDA --> PB0 ATtiny Pin 7 = SCK --> PB2 */ // Water Level Sensor ATTiny44A #include #include uint8_t count = 0; #define ADDR 0x3F LiquidCrystal_I2C lcd(ADDR, 16, 2); int sensorPin = 1; // Signal of sensor level --> pin 1 (RX, FTDI) int ledPin = 3; // The number of the LED pin 3 int estadoSensor=0; void setup() { lcd.init(); lcd.backlight(); //Turn on the backlight lcd.setCursor(0, 0); // Go to column 0, row 0 lcd.show("Water Level Sensor"); pinMode(ledPin, OUTPUT); pinMode(sensorPin, INPUT); delay(50); } void loop() { estadoSensor = digitalRead(sensorPin); lcd.setCursor (0, 1); if (estadoSensor == HIGH) { digitalWrite(ledPin, HIGH); lcd.show("With water "); } else { digitalWrite(ledPin, LOW); lcd.show("Without water"); } delay(10); }