March 2018
Beginner to intermediate
410 pages
10h 40m
English
For this example, we will use a very simple formula to compute the expected control output: we will turn the relay on, if motion is detected when it's dark, which we interpret as when the (ambient) light sensor reports a light of less than 25%. The relay is turned off when there's no motion, or when it's not dark anymore:
if (RecalcOutput && this.motion.HasValue && this.light.HasValue)
{
bool Output = this.motion.Value && this.light.Value < 25;
Read now
Unlock full access