/* Program by R. Jordan Kreindler Sketch to read analog voltages from two potentiometers */ #include LiquidCrystal_I2C lcd(0x27, 16, 2); // Piggyback lcd(address one of 0x3F or 0x27,16,2); #define potWiperPin1 34 // Set the pin where the wiper from potentiometer one connects #define potWiperPin2 35 // Set the pin where the wiper from potentiometer two connects int delay1 = 1000; // The delay between readings int value1; // The output value of potentiometer one int value2; // The output value of potentiometer two void setup() { lcd.init(); // Initialize the LCD display lcd.backlight(); // Turn the LCD backlight on } void loop() { value1 = analogRead(potWiperPin1); // Read the value of potentiometer one value2 = analogRead(potWiperPin2); // Read the value of potentiometer one lcd.clear(); // Clear the LCD display lcd.setCursor(0, 0); // Place the cursor at position zero on line 0 lcd.print("Pot1 Value:"); // Display the value for potentiometer one lcd.print(value1); lcd.setCursor(0, 1); // Place the cursor at position zero on line 1 lcd.print("Pot2 Value:"); // Display the value for potentiometer two lcd.print(value2); delay(delay1); // Delay delay1 milliseconds }