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