MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / beat

Method beat

libraries/HeartBeat/HeartBeat.cpp:78–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76
77
78void HeartBeat::beat()
79{
80 if (_running == false)
81 {
82 _state = LOW;
83 }
84 else
85 {
86 uint32_t now = micros();
87 if ((_state == LOW) && (now - _lastHeartBeat) < _dutyCycleLow) return;
88 if ((_state == HIGH) && (now - _lastHeartBeat) < _dutyCycleHigh) return;
89 _lastHeartBeat = now;
90 _state = !_state;
91 }
92 digitalWrite(_pin, _state);
93}
94
95
96uint8_t HeartBeat::getState()

Callers 1

unittestFunction · 0.80

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.64