Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
查看: 2703|回復: 0
打印 上一主題 下一主題

想請教一下 ARDUINO的SENSOR 大氣壓力傳感器BMP180

[複製鏈接]
跳轉到指定樓層
1#
發表於 2014-12-25 19:35:07 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
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);
}

未命名.png (1.4 MB, 下載次數: 282)

執行結果

執行結果
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2025-1-31 13:07 , Processed in 0.305175 second(s), 9 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表