Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. /*
  2. The circuit:
  3.  * LCD RS pin to digital pin 12
  4.  * LCD Enable pin to digital pin 11
  5.  * LCD D4 pin to digital pin 5
  6.  * LCD D5 pin to digital pin 4
  7.  * LCD D6 pin to digital pin 3
  8.  * LCD D7 pin to digital pin 2
  9.  * LCD R/W pin to ground
  10.  * LCD VSS pin to ground
  11.  * LCD VCC pin to 5V
  12.  * 10K resistor:
  13.  * ends to +5V and ground
  14.  * wiper to LCD VO pin (pin 3)
  15. */
  16.  
  17. //Include the Temp Sensor Library
  18. #include <LM35.h>
  19.  
  20. //Include the LCD Library
  21. #include <LiquidCrystal.h>
  22.  
  23. //Initialise the library with the numbers of the interface pins
  24. LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
  25.  
  26. void setup() {
  27.  
  28.   //Setup the number of columns and rows
  29.   lcd.begin(16, 2);
  30.  
  31. }
  32.  
  33. void loop() {
  34.  
  35.   //Temp sensor connected to pin A0
  36.   LM35 sensor1(A0);
  37.  
  38.   //Makes an int called temp1 and sets it to teh average of 5 readings of the temp sensor
  39.   int temp1 = sensor1.read(5);
  40.  
  41.   //Sets the LCD cursor to column 0, line 1 (1st line)
  42.   lcd.setCursor(0, 0);
  43.  
  44.   //Print the temperature
  45.   lcd.print(temperature);
  46.   lcd.print(" DegC");
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement