#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// INPUT: Potentiometer should be connected to 5V and GND
int potPin = A0; // Potentiometer output connected to analog pin 3
int potVal = 0; // Variable to store the input from the potentiometer
int x = 3;// Math variable
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
Serial.begin(9600); // setup serial
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
potVal = analogRead(potPin);
int y = sq(x);// Math equation
lcd.setCursor(0, 1);
lcd.print(potVal);
Serial.println(x);// Print Math variable
Serial.println(y);// Print math result
delay(1000);
lcd.clear();
}