此代码已经从Adafruit传感器库修改。
请在这里下载或复制并粘贴以下为黑色素描。
这需要一些知识和Arduino IDE,你可以阅读在这里
<p>#include <Wire.h><br>#include <Adafruit_Sensor.h></p><p>#include < Adafruit_BMP085_U.h></p><p>#include <LiquidCrystal.h></p><p>LiquidCrystal lcd(8, 9, 4, 5, 6, 7);</p><p>/* This driver uses the Adafruit unified sensor library (Adafruit_Sensor),
which provides a common 'type' for sensor data and some helper functions.
To use this driver you will also need to download the Adafruit_Sensor
library and include it in your libraries folder.</p><p> You should also assign a unique ID to this sensor for use with
the Adafruit Sensor API so that you can identify this particular
sensor in any data logs, etc. To assign a unique ID, simply
provide an appropriate value in the constructor below (12345
is used by default in this example).
Connections
===========
Connect SCL to analog 5
Connect SDA to analog 4
Connect VDD to 3.3V DC
Connect GROUND to common ground
History
=======
2013/JUN/17 - Updated altitude calculations (KTOWN)
2013/FEB/13 - First version (KTOWN)
*/
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);</p><p>//Setting up variables for calculating a rolling average for pressure
const int numReadings = 50;</p><p>float readings[numReadings]; // the readings from the analog input
int readIndex = 0; // the index of the current reading
float total = 0; // the running total
float average = 0; // the average
/**************************************************************************/
/*
Displays some basic information on this sensor from the unified
sensor API sensor_t type (see Adafruit_Sensor for more information)
*</p><p>**************************************************************************/
/*
Arduino setup function (automatically called at startup)
*/
/**************************************************************************/
void setup(void)
{
Serial.begin(9600);
Serial.println("Pressure Sensor Test"); Serial.println("");</p><p> for (int thisReading = 0; (责任编辑:admin)