User Tools

Site Tools

한국어

cfnet:cfheader:csharp:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
cfnet:cfheader:csharp:index [2026/05/29 05:52] mfranklincfnet:cfheader:csharp:index [2026/05/29 06:06] (current) – [Simple Digital Output Example] mfranklin
Line 3: Line 3:
 After [[cfnet:cfheader:development_environment:index|setting up a development environment]], simply [[cfnet:cfheader:connecting_to_usb_host:index|connect the CFHEADER module to the development machine]], and then use Visual Studio, and any .NET language (e.g. C# or VB.NET), to automate the IO modules using the [[https://api.comfiletech.com/csharp/api/ComfileTech.Cfnet.Cfheader.html|ComfileTech.Cfnet.Cfheader API]].   After [[cfnet:cfheader:development_environment:index|setting up a development environment]], simply [[cfnet:cfheader:connecting_to_usb_host:index|connect the CFHEADER module to the development machine]], and then use Visual Studio, and any .NET language (e.g. C# or VB.NET), to automate the IO modules using the [[https://api.comfiletech.com/csharp/api/ComfileTech.Cfnet.Cfheader.html|ComfileTech.Cfnet.Cfheader API]].  
  
-Debug the entire solution on the Windows development machine before deploying to an ARM Linux or other target device.  Since the development machine is usually much more powerful than the target device, local edit-run-debug iterations are far more productive. 
  
 ===== Simple Digital Output Example ===== ===== Simple Digital Output Example =====
  
 <code csharp> <code csharp>
 +using ComfileTech.Cfnet.Cfheader;
 +
 var cfheader0 = Cfheader.Instances[0]; var cfheader0 = Cfheader.Instances[0];
-var digitalOutputModule0 = cfheader0.DigitalOutputModules[0];+var DOModule0 = cfheader0.DigitalOutputModules[0];
  
 cfheader0.Open(); cfheader0.Open();
Line 15: Line 16:
 while (true) while (true)
 { {
-    // Blink each output in increasing order +    foreach (var channel in DOModule0.Channels.Concat(DOModule0.Channels.Reverse()))
-    foreach (var channel in digitalOutputModule0.Channels)+
     {     {
-        channel.State = !channel.State; +        foreach (var state in new[] { true, false }
-        Thread.Sleep(50); +        
-        channel.State = !channel.State; +            channel.State = state
-        Thread.Sleep(50); +            cfheader0.Sync(); 
-    } +            Thread.Sleep(50); 
- +        }
-    // Blink each output in decreasing order +
-    foreach (var channel in digitalOutputModule0.Channels.Reverse()+
-    +
-        channel.State = !channel.State+
-        Thread.Sleep(50); +
-        channel.State = !channel.State; +
-        Thread.Sleep(50);+
     }     }
 } }
Line 36: Line 29:
  
 {{ :cfnet:cfheader:automating_io_modules:kitt.mp4?900x506 }} {{ :cfnet:cfheader:automating_io_modules:kitt.mp4?900x506 }}
 +
 +Debug the entire solution on the Windows development machine before deploying to an ARM Linux or other target device.  Since the development machine is usually much more powerful than the target device, local edit-run-debug iterations are far more productive.
  
 ===== Contents ===== ===== Contents =====
cfnet/cfheader/csharp/index.1780033950.txt.gz · Last modified: by mfranklin