Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- The circuit:
- * LCD RS pin to digital pin 12
- * LCD Enable pin to digital pin 11
- * LCD D4 pin to digital pin 5
- * LCD D5 pin to digital pin 4
- * LCD D6 pin to digital pin 3
- * LCD D7 pin to digital pin 2
- * LCD R/W pin to ground
- * LCD VSS pin to ground
- * LCD VCC pin to 5V
- * 10K resistor:
- * ends to +5V and ground
- * wiper to LCD VO pin (pin 3)
- */
- //Include the Temp Sensor Library
- #include <LM35.h>
- //Include the LCD Library
- #include <LiquidCrystal.h>
- //Initialise the library with the numbers of the interface pins
- LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
- void setup() {
- //Setup the number of columns and rows
- lcd.begin(16, 2);
- }
- void loop() {
- //Temp sensor connected to pin A0
- LM35 sensor1(A0);
- //Makes an int called temp1 and sets it to teh average of 5 readings of the temp sensor
- int temp1 = sensor1.read(5);
- //Sets the LCD cursor to column 0, line 1 (1st line)
- lcd.setCursor(0, 0);
- //Print the temperature
- lcd.print(temperature);
- lcd.print(" DegC");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement