forked from steffalk/AbstractIO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSample01SimpleBlinker.cs
More file actions
29 lines (27 loc) · 867 Bytes
/
Sample01SimpleBlinker.cs
File metadata and controls
29 lines (27 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Threading;
namespace AbstractIO.Samples
{
/// <summary>
/// Demonstrates simple digital output by blinking any output, for example, a LED.
/// </summary>
public static class Sample01SimpleBlinker
{
/// <summary>
/// Blinks any <see cref="IBooleanOutput"/>.
/// </summary>
/// <param name="lamp">The output to "blink".</param>
public static void Run(IBooleanOutput lamp)
{
// Check parameters:
if (lamp == null) throw new ArgumentNullException(nameof(lamp));
// Blink the passed-in lamp.
// Note that we do not need to know anything about the actual physical output used:
while (true)
{
lamp.Value = !lamp.Value;
Thread.Sleep(500);
}
}
}
}