| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| cfnet:cfheader:csharp:index [2026/05/29 05:01] – [Contents] mfranklin | cfnet:cfheader:csharp:index [2026/05/29 06:06] (current) – [Simple Digital Output Example] mfranklin |
|---|
| ====== CFHEADER C# API ====== | ====== CFHEADER .NET (C#, VB.NET) 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 like C# or VB.NET, to automate the IO 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]]. |
| |
| Enjoy the convenience and efficiency of debugging 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 ===== |
| | |
| | <code csharp> |
| | using ComfileTech.Cfnet.Cfheader; |
| | |
| | var cfheader0 = Cfheader.Instances[0]; |
| | var DOModule0 = cfheader0.DigitalOutputModules[0]; |
| | |
| | cfheader0.Open(); |
| | |
| | while (true) |
| | { |
| | foreach (var channel in DOModule0.Channels.Concat(DOModule0.Channels.Reverse())) |
| | { |
| | foreach (var state in new[] { true, false }) |
| | { |
| | channel.State = state; |
| | cfheader0.Sync(); |
| | Thread.Sleep(50); |
| | } |
| | } |
| | } |
| | </code> |
| | |
| | {{ :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 ===== |
| |
| * [[..:development_environment:index|Setting Up a Development Environment]] - Describes how to set up a development environment for programming a CFHDR-8U module using Visual Studio. | * [[..:development_environment:index|Setting Up a Development Environment]] - Describes how to set up a development environment for programming a CFHDR-8U module using Visual Studio. |
| | * [[..:runtime_environment:index|Setting Up a Runtime Environment]] - Describes how to configure a target computer to deploy a CFHDR-8U .NET application to. |
| * [[..:create_new_project:|Creating a New Project]] - Describes how to create a new CFHDR-8U .NET project from scratch. | * [[..:create_new_project:|Creating a New Project]] - Describes how to create a new CFHDR-8U .NET project from scratch. |
| * [[..:mode_of_operation:|Mode of Operation]] - Describes the primary mode of operation of a CFHDR-8U module, and the typical programming patterns used to automate it. | * [[..:mode_of_operation:|Mode of Operation]] - Describes the primary mode of operation of a CFHDR-8U module, and the typical programming patterns used to automate it. |