i tried the "particle subscribe weatherstation 012234567abc123" (replacing the last string with the device ID), however I still receive the same message. I also tried adding the "--private" after the device ID.
Below is the code, only change from @who is triggering the sleep with a LOW pulse. I also didn't connect the WAKE-RST solder pad.
Any suggestions for where i'm still going wrong?
#include <Wire.h>
#include "SparkFunHTU21D.h"
#include "SFE_BMP180.h"
//#include "Particle.h"
HTU21D htu;
SFE_BMP180 bmp;
#define ALTITUDE 509 // Alt in meters
#define PCF8591 (0x90 >> 1) // I2C bus address
#define ADC0 0x00 // ADC0
int Sleep_pin = 5; // Config as INPUT_PULLUP to default HIGH
int OakLEDpin = 1; // Oak onboard LED pin 1
int sleepTimes = 150; // 150 seconds
float temperature, humidity, pressure, ambient;
void fetchTemperature(){
temperature = htu.readTemperature();
}
void fetchHumidity(){
humidity = htu.readHumidity();
}
void fetchPressure(){
char status = bmp.startTemperature();
char buffer[10];
double T,P,p0;
if(status != 0){
delay(status);
status = bmp.getTemperature(T);
if(status != 0){
status = bmp.startPressure(3);
if(status != 0){
delay(status);
status = bmp.getPressure(P,T);
if(status != 0){
pressure = bmp.sealevel(P,ALTITUDE);
} else Particle.publish("error retrieving pressure measurement\n");
} else Particle.publish("error starting pressure measurement\n");
} else Particle.publish("error retrieving temperature measurement\n");
} else Particle.publish("error starting temperature measurement\n");
}
void printData(){
char tmpStr[64];
sprintf(tmpStr, "weather;%s;%s;%s;%s", String(temperature).c_str(), String(ambient).c_str(), String(pressure).c_str(), String(humidity).c_str());
Particle.publish("weatherstation", tmpStr, 60, PRIVATE);
}
void fetchAmbient(){
byte value0;
Wire.beginTransmission(PCF8591); // wake up PCF8591
Wire.write(ADC0); // control byte - read ADC0
Wire.endTransmission();
Wire.requestFrom(PCF8591, 2);
value0 = Wire.read();
value0 = Wire.read();
delay(200);
ambient = value0;
}
void setup() {
pinMode(Sleep_pin, INPUT_PULLUP); // default to HIGH
htu.begin();
if(!bmp.begin()){
Particle.publish("Error, bmp not connected!");
while(1);
}
fetchTemperature();
fetchHumidity();
fetchPressure();
fetchAmbient();
printData();
if(digitalRead(Sleep_pin) == LOW){
ESP.deepSleep(sleepTimes*1000000, WAKE_RF_DEFAULT);
}
}
void loop() {
// put your main code here, to run repeatedly:
}