Skip to content

Instantly share code, notes, and snippets.

@rudelm
Last active July 6, 2017 18:34
Show Gist options
  • Save rudelm/463c59a218a4c17fdad8228356446f8b to your computer and use it in GitHub Desktop.
Save rudelm/463c59a218a4c17fdad8228356446f8b to your computer and use it in GitHub Desktop.
Code from Johannes Z to read out LCD Keypad Shield values
// code provided by Johannes Z
// https://forum.lrtimelapse.com/Thread-alternative-lcd-keypad-shields?pid=31865#pid31865
//Initialize LCD
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup()
{
//Set LCD Display Size
lcd.begin(16,2);
lcd.clear();
//Control LED Backlight @ D10
pinMode(10, OUTPUT);
}
void loop()
{
//Set LED Backlight to OFF
digitalWrite(10, LOW);
//Read Shield Button from Analog 0 Pin
double button = analogRead(0);
//Set LCD Display Settings
lcd.setCursor(0,0);
lcd.println("Analog 0 Value: ");
lcd.setCursor(0,1);
lcd.print(button);
lcd.println(" ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment