接線圖bmp

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

byte nuidPICC[4]; 
char buff[20];

Adafruit_BMP085 bmp;//氣壓傳感器
bool bmp_present = false;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Wire.begin();
  SPI.begin(); // Init SPI bus
  if (bmp.begin()) bmp_present = true;
}
long now;
void loop() {
if(millis()-now>1000){
  now=millis();
  if(bmp_present){
  sprintf(buff,"{\"pressure\":%ld}",bmp.readPressure());
  Serial.println(buff);
  }
  memset(buff,0,20);
}
  
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章