You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/PressureSensor/PressureSensor.ino
+9-10Lines changed: 9 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@
64
64
// #define BATTERY_POWERED // Just remove the two slashes at the beginning of this line if your node is battery powered. It will then go into deep sleep as much as possible. While it's sleeping it can't work as a repeater!
65
65
66
66
// Would you like the sensor to generate a weather forecast based on the barometric pressure?
67
-
#defineGENERATE_FORECAST// Just remove the two slashes at the beginning of this line to enable this feature.
67
+
#defineGENERATE_FORECAST
68
68
69
69
70
70
// LIBRARIES
@@ -81,13 +81,13 @@ const float ALTITUDE = 14; // Change this value to your l
81
81
unsignedlong BME280measurementInterval = 60000; // Sleep time between reads for the BME sensor (in ms). Keep this value at 60000 if you have enabled the forecast feature, as the forecast algorithm needs a sample every minute.
82
82
#defineCOMPARE_TEMP1// Send temperature only if it changed? 1 = Yes 0 = No. Can save battery.
83
83
float tempThreshold = 0.1; // How big a temperature difference has to minimally be before an update is sent. Makes the sensor less precise, but also less jittery, and can save battery.
84
-
#defineCOMPARE_HUM1// Send temperature only if changed? 1 = Yes 0 = No. Can save battery.
84
+
#defineCOMPARE_HUM1// Send humidity only if changed? 1 = Yes 0 = No. Can save battery.
85
85
float humThreshold = 0.1; // How big a humidity difference has to minimally be before an update is sent. Makes the sensor less precise, but also less jittery, and can save battery.
86
-
#defineCOMPARE_BARO1// Send temperature only if changed? 1 = Yes 0 = No. Can save battery.
86
+
#defineCOMPARE_BARO1// Send barometric pressure only if changed? 1 = Yes 0 = No. Can save battery.
87
87
float presThreshold = 0.1; // How big a barometric difference has to minimally be before an update is sent. Makes the sensor less precise, but also less jittery, and can save battery.
88
88
89
89
90
-
//VARIABLES YOU PROBABLY SHOULDN'T CHANGE
90
+
//VARIABLES YOU PROBABLY SHOULDN'T CHANGE
91
91
#defineTEMP_CHILD_ID0// for MySensors. Within this node each sensortype should have its own ID number.
92
92
#defineHUM_CHILD_ID1// for MySensors. Within this node each sensortype should have its own ID number.
93
93
#defineBARO_CHILD_ID2// for MySensors. Within this node each sensortype should have its own ID number.
@@ -114,7 +114,7 @@ enum FORECAST
114
114
int lastForecast = -1; // Stores the previous forecast, so it can be compared with a new forecast.
115
115
constint LAST_SAMPLES_COUNT = 5;
116
116
float lastPressureSamples[LAST_SAMPLES_COUNT];
117
-
int minuteCount = 0; // Helps the forecst algorithm keep time.
117
+
int minuteCount = 0; // Helps the forecast algorithm keep time.
118
118
bool firstRound = true; // Helps the forecast algorithm recognise if the sensor has just been powered up.
119
119
float pressureAvg; // Average value is used in forecast algorithm.
120
120
float pressureAvg2; // Average after 2 hours is used as reference value for the next iteration.
@@ -271,8 +271,8 @@ void loop() {
271
271
}
272
272
#endif
273
273
274
-
Serial.println("BME280 - Measurement complete. Going to wait until next measurement.");
275
-
BME280shouldAsk = true; // Ready for the new round.
274
+
Serial.println("BME280 - Measurement complete. Going to wait until next measurement.");
275
+
BME280shouldAsk = true; // Ready for the new round.
276
276
}
277
277
278
278
#ifdef BATTERY_POWERED
@@ -281,7 +281,7 @@ void loop() {
281
281
unsignedlong quicktimecheck = millis(); // To check how much time has passed since the beginning of being awake, and then calculate from that how long to sleep until the next intended measuring time, we need to know how many milliseconds have passed.
282
282
unsignedlong sleeptime = BME280measurementSleepTime - (quicktimecheck - previousBME280Millis); // How much time has passed already during the calculating? Subtract that from the intended interval time.
0 commit comments