#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);
}
  
}

 

接线图bmp

相关文章:

  • 2022-01-16
  • 2022-02-16
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2021-07-17
猜你喜欢
  • 2021-11-07
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
相关资源
相似解决方案