Browse Source

send sds values

ir
Hendrik Langer 5 years ago
parent
commit
02e9fb7e83
  1. 17
      src/main.cpp

17
src/main.cpp

@ -170,6 +170,23 @@ void sendValues() {
mqtt.publish(topic_uvi.c_str(), uvi, sizeof(uvb));
}
if (sds_active) {
PmResult pm = sds.readPm();
if (pm.isOk()) {
String topic_pm10 = String("thomas/sensor/") + ota.getMAC() + String("/pm10");
char pm10[10]; sprintf(pm10, "%.2f", pm.pm10);
String topic_pm25 = String("thomas/sensor/") + ota.getMAC() + String("/pm25");
char pm25[10]; sprintf(pm25, "%.2f", pm.pm25);
mqtt.publish(topic_pm10.c_str(), pm10, sizeof(pm10));
mqtt.publish(topic_pm25.c_str(), pm25, sizeof(pm25));
// if you want to just print the measured values, you can use toString() method as well
Serial.println(pm.toString());
}
}
}
/**

Loading…
Cancel
Save