// Get the CFHEADER module at address 0
var cfheader0 = Cfheader.Instances[0];
 
// Try to open USB communication with the CFHEADER module.
try
{
    cfheader0.Open();
}
catch(Exception ex)
{
    Console.Error.WriteLine($"Could not open communication with CFHEADER module at address {cfheader0.Address}.");
    Environment.Exit(1);
}
 
// Try communicating over USB with the CFHEADER module
try
{
    while(true)
    {
        cfheader0.Sync();
    }
}
catch(Exception ex)
{
    Console.Error.WriteLine($"Communication with CFHEADER module at address {cfheader0.Address} failed.");
    Environment.Exit(1);
}
 
// Close USB communication with the CFHEADER module.
cfheader0.Close();