Arduino Analog Input Display
Arduino Analog Input Display
hi, this is a simple instructable that shows you how to use an analog input (potentiometer) and
display that in percentage form on a 16X2 LCD character display
*/
#include <LiquidCrystal.h> // include the LCD library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void loop() {
// read then divide the input(max 1020 in this case) by 10
potValue1 = analogRead(potPin) / 10;
// divide by 1.02 to get percentage
potValue2 = potValue1 / 1.02;
// set cursor to second row, first column
lcd.setCursor(0, 1);
//display final percentage
lcd.print(potValue2);
//print the percent symbol at the end
lcd.print("%");
//wait 0.1 seconds
delay(100);
//wipe the extra characters
lcd.print(" ");
delay(1);
}