/* LiquidCrystal library with DRobotics shield. Pins configured with DRobotics LCD shield. http://www.droboticsonline.com/index.php/review/product/list/id/7/ Example circuit for printing temperature from an LM34. The circuit: * LCD RS pin to digital pin 8 * LCD Enable pin to digital pin 9 * LCD D4 pin to digital pin 4 * LCD D5 pin to digital pin 5 * LCD D6 pin to digital pin 6 * LCD D7 pin to digital pin 7 LM34 into +5V, GND Middle pin to Analog pin 1 (Analog 0 is used by the DRobotics shield) Library originally added 18 Apr 2008 by David A. Mellis library modified 5 Jul 2009 by Limor Fried (http://www.ladyada.net) example added 9 Jul 2009 by Tom Igoe modified 25 July 2009 by David A. Mellis modified 15 Mar 2010 by Tim Gibbon Modified from http://www.arduino.cc/en/Tutorial/LiquidCrystal http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235965293 */ // include the library code: #include int sensor_pin = 1; // the analog pin for LM34 temp sensor - Cannot use pin 0 as it is used for something by DRobotics LCD shield float sensor_reading = 0.0; // variable to store the value coming from the sensor float vref = 1.084; // variable to store the voltage reference used (check for validity with a DMM) int fahrenheit = 0; // variable to store the actual temperature int acquisition_timer = 1000; // variable to control the time between updates (in ms) int centigrade = 0; int loop_counter = 0; // initialize the library with the numbers of the interface pins - suitable for DRobotics LCD Keypad shield LiquidCrystal lcd(8, 9, 4, 5, 6, 7); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16,2); pinMode( sensor_pin, INPUT ); // set LM34 temp sensor pin as an input analogReference(INTERNAL); // set the analog reference to the 1.1V internal reference delay(1000); } void loop() { sensor_reading = analogRead(sensor_pin); // stores the digitized (0 - 1023) analog reading from the LM34 fahrenheit = (100.0 * sensor_reading * vref)/1023; // calculates the actual fahrenheit temperature centigrade = (((5.0/9.0))*(fahrenheit-32.0)); //conversion to degrees C // set the cursor to (0,0): lcd.setCursor(0, 0); lcd.print("Temp="); lcd.print(centigrade); lcd.print("C"); //Print useful counter on the second row lcd.setCursor(0,1); lcd.print(loop_counter); loop_counter++; delay(5000); // turn off automatic scrolling lcd.noAutoscroll(); // clear screen for the next loop: lcd.clear(); }