#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int potPinA0 = A0;
int potPinA1 = A1;
int potPinA2 = A2;
int ledPin = 13;
int potValueA0 = 0;
int potValueA1 = 0;
int potValueA2 = 0;
int mappedValueA0 = 0;
int mappedValueA1 = 0;
int mappedValueA2 = 0;
void setup() {
lcd.init();
lcd.backlight();
pinMode(ledPin, OUTPUT);
}
void loop() {
potValueA0 = analogRead(potPinA0);
potValueA1 = analogRead(potPinA1);
potValueA2 = analogRead(potPinA2);
mappedValueA0 = map(potValueA0, 0, 1023, 0, 9);
mappedValueA1 = map(potValueA1, 0, 1023, 0, 9);
mappedValueA2 = map(potValueA2, 0, 1023, 0, 9);
lcd.setCursor(0, 0);
lcd.print("A0: ");
lcd.print(mappedValueA0);
lcd.setCursor(6, 0);
lcd.print("A1: ");
lcd.print(mappedValueA1);
lcd.setCursor(12, 0);
lcd.print("A2: ");
lcd.print(mappedValueA2);
if(mappedValueA0 == 6 && mappedValueA1 == 6 && mappedValueA2 == 6){
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
delay(1000);
}