Skip to main content
. 2018 May 25;18(6):1709. doi: 10.3390/s18061709
Algorithm 4 Wireless sensor measuring T, RH, and light intensity
1: Initialize components
2: Get batt. level
3: whileTruedo                          ▹ Main app. loop
4:   Process BLE events
5:   if (1 min. passed) then
6:    if (batt. level and light data from RAM > thresholds) then
7:     Power up sensors
8:     Wake up all components
9:     Measure T and RH, save data to RAM
10:     Get light intensity, save data to RAM
11:    else
12:     Increase postponed measurement counter
13:    end if
14:    Get batt. level, save data to RAM
15:    Power down all sensors
16:    Prepare for low power mode
17:   end if
18:  Update advertising payload with data from RAM
19:   Enter low power mode
20: end while