Categories

BMP085 temperature readings on an LCD

lcd keypad shield

lcd keypad shield

Code

#include <Wire.h>
#include <Adafruit_BMP085.h>
#include <LiquidCrystal.h>

Adafruit_BMP085 bmp;

// Connections: Sainsmart LCD/Keypad shield
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup()
{
//Serial.begin(9600);
delay(1000);
//setup the LCD
lcd.begin(16, 2); // start the library
lcd.setCursor(0,0);
lcd.print(“Temperature”);
//debug the bmp085 sensor
Serial.begin(9600);
if (!bmp.begin())
{
Serial.println(“Could not find a BMP085 sensor!”);
while (1) {}
}
}

void loop()
{

//read temperature and output via LCD
lcd.setCursor(0,1);
lcd.print(bmp.readTemperature());
delay(1000);

}
Share

BMP085 example

This example uses the BMP05 Barometric, pressure and Temperature sensor. It requires the BMP085 library from adafruit. This is a nice little sensor.

 

#include <Wire.h>
#include <Adafruit_BMP085.h>

Adafruit_BMP085 bmp;

void setup()
{
Serial.begin(9600);
if (!bmp.begin())
{
Serial.println("Could not find a BMP085 sensor!");
while (1) {}
}
}

void loop()
{
Serial.print("Temperature = ");
Serial.print(bmp.readTemperature());
Serial.println(" *C");

Serial.print("Pressure = ");
Serial.print(bmp.readPressure());
Serial.println(" Pa");

Serial.print("Altitude = ");
Serial.print(bmp.readAltitude());
Serial.println(" meters");

Serial.print("Real altitude = ");
Serial.print(bmp.readAltitude(101500));
Serial.println(" meters");

Serial.println();
delay(500);
}
Share