|
https://www.youtube.com/watch?v=z9AzZM1-Dns#t=459
今天想要用BMP180這塊SENSOR可是我照著這影片裡面操作
偵錯沒問題也可以"燒錄",ANALOG IN 也沒接錯
電源3.3V 5V 也都試過了
LIBRARY也有匯入
SENSOR 傳給電腦的數值一直是0度,想請問各位前輩有沒有類似經驗可以提供
附上程式碼
#include <Wire.h>
#include "Adafruit_BMP085.h"
/***************************************************
This is an example for the BMP085 Barometric Pressure & Temp Sensor
Designed specifically to work with the Adafruit BMP085 Breakout
----> https://www.adafruit.com/products/391
These displays use I2C to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
// Connect VCC of the BMP085 sensor to 3.3V (NOT 5.0V!)
// Connect GND to Ground
// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5
// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4
// EOC is not used, it signifies an end of conversion
// XCLR is a reset pin, also not used here
Adafruit_BMP085 mySensor;
float temC;
float temF;
float pressure;
void setup() {
Serial.begin(9600);
mySensor.begin();
}
void loop() {
temC=mySensor.readTemperature();
temF=temC*1.8+32;
pressure=mySensor.readPressure();
Serial.print("the tmp is:");
Serial.print(temF);
Serial.println("degree F.");
Serial.print("the pressure is:");
Serial.print(pressure);
Serial.println("pa.");
Serial.println("");
delay(1000);
}
|
|