This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| cfnet:cfheader:csharp:index [2026/05/29 05:57] – [Simple Digital Output Example] mfranklin | cfnet:cfheader:csharp:index [2026/05/29 06:06] (current) – [Simple Digital Output Example] mfranklin | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| <code csharp> | <code csharp> | ||
| - | const int delayMs = 50; | + | using ComfileTech.Cfnet.Cfheader; |
| - | var header | + | var cfheader0 |
| - | var channels | + | var DOModule0 |
| - | var states = new[] { true, false }; | + | |
| - | header.Open(); | + | cfheader0.Open(); |
| while (true) | while (true) | ||
| { | { | ||
| - | foreach (var channel in channels.Concat(channels.Reverse())) | + | foreach (var channel in DOModule0.Channels.Concat(DOModule0.Channels.Reverse())) |
| { | { | ||
| - | foreach (var state in states) | + | foreach (var state in new[] { true, false }) |
| { | { | ||
| channel.State = state; | channel.State = state; | ||
| - | | + | |
| - | Thread.Sleep(delayMs); | + | Thread.Sleep(50); |
| } | } | ||
| } | } | ||