Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h> //library for the LCD display
- LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //analog output of arduino's pins
- int lcdbl = 10; // defining a variable for LCD Backlight: hooking up the lcdbacklight to pin 10
- float temp; //defining a variable
- int tempPin = 0; //temperature sensor's pin
- void setup() //run once
- {
- Serial.begin(9600); //set up Serial library at 9600 bps
- lcd.begin(8,2); // columns, rows
- digitalWrite(lcdbl, HIGH);
- pinMode(lcdbl, OUTPUT); // set pin 11 to output
- analogWrite(lcdbl, 255); //setting the backlight on
- }
- void loop() // run over and over again
- {
- temp = analogRead(tempPin)/9.31; //read the input from analog pin 0 and convert the raw data to Celsius
- lcd.print(temp); //print the data to the LCD
- lcd.print("*C"); //print a letter C after the data.
- lcd.clear(); //clear the display
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement