Monitor for central heating system (e.g. 2zones+hw) Supports up to 15 temp probes (DS18B20/DS18S20) 3 valve monitors Gas pulse meter recording Use stand-alone or with nodeEnergyServer See http://robdobson.com/2015/09/central-heating-monitor
Dependencies: EthernetInterfacePlusHostname NTPClient Onewire RdWebServer SDFileSystem-RTOS mbed-rtos mbed-src
VoltAlerter.cpp
- Committer:
- Bobty
- Date:
- 2015-10-16
- Revision:
- 23:fd5a5a9f30bc
- Parent:
- 10:72eb217def1f
File content as of revision 23:fd5a5a9f30bc:
// Detect stat of Volt-Alerter // Device produces a square wave when voltage detected // Cycle time of square wave around 100ms // Rob Dobson, 2015 #include "VoltAlerter.h" VoltAlerter::VoltAlerter(PinName pinName) : _inPin(pinName, PullUp) { _curPinState = 0; _consecutiveLows = 0; } void VoltAlerter::Service() { // Check pin if (!_inPin) { _curPinState = 1; _consecutiveLows = 0; return; } // Only set state low if we get X consecutive lows _consecutiveLows++; if (_consecutiveLows >= CONSECUTIVE_LOWS_REQD_FOR_LOW) { _curPinState = 0; // The following is just to ensure the int doesn't overflow _consecutiveLows = CONSECUTIVE_LOWS_REQD_FOR_LOW; } }