Home Chipkit Display LDR value on LCD connected to chipkit UNO

Display LDR value on LCD connected to chipkit UNO

by shedboy71

In this example we keep the LCD shield connected to our Chipkit UNO and this time we will connect an LDR to A4, read the value in and display it on the LCD display

I used an LDR breakout but its basically shown in the schematic below




#include <LiquidCrystal.h>
const int analogInPin = A4;  // Analog input pin that the LDR is attached to
int sensorValue = 0;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup() 
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("LDR reading!");
void loop() 
  sensorValue = analogRead(analogInPin);
  // set the cursor to column 0, line 1
  lcd.setCursor(0, 1);
  // print the LDR reading

You may also like

1 comment

chipKIT Uno32 with Arduino LCD Shield » chipKIT Development Platform 2nd April 2015 - 10:34 pm

[…] to get your chipKIT Uno32 up and running with the Arduino LCD Shield! For a more useful example, check out this example for how to connect and display a Photoresistor or LDR (Light Dependent Resistor) to your circuit […]

Comments are closed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More