
You need to connect the lcd ( 1602 or 16x2) in the following way:

Beginners tutorial to lcd : https://www.arduino.cc/en/Tutorial/HelloWorld
The code :
#include
int input = A0;
LiquidCrystal lcd(12,11,5,4,3,2);
BigNumbers bigNum(&lcd); // construct BigNumbers object, passing to it the name of our LCD object
void setup()
{
TCCR1B = TCCR1B & 0b11111000 | 0x01; // use for Arduino Uno
// TCCR2B = TCCR1B & 0b11111000 | 0x01; // use for Arduino Mega2560
pinMode(input,INPUT);
lcd.begin(16,2); // setup LCD rows and columns
bigNum.begin(); // set up BigNumbers
lcd.clear(); // clear display
}
void loop()
{
int value=analogRead(input);
bigNum.displayLargeInt(value, 0, 5, false); // value is integer,5 is print position
// 1 to 6 for position
lcd.setCursor(0,0);
lcd.print("Value");
delay(200);
}
End.
Comments
Post a Comment