public static void Sample2() { var current = 1; IPowerSupply powerSupply = PowerSupplyFactory.BKPrecision9206ComPort(); //Connect BK Precision 9206 to COM port powerSupply.EnableOutputs(); //Enable outputs powerSupply.SetCurrentOutput(current); //Set Current string actualCurrent = powerSupply.ReadCurrentValue(); //Read Current if ((actualCurrent != "") && (current == Convert.ToInt32(actualCurrent))) //Compare currents { Console.WriteLine("Power Supply BKPrecision 9206 over Com port works correctly."); } else { Console.WriteLine("The set and actual current is not equal."); } powerSupply.Disconnect(); //Disconect from COM port }
public static void Sample1() { var voltage = 20; IPowerSupply powerSupply = PowerSupplyFactory.BKPrecision9132BComPort(); //Connect BK Precision 9132B to COM port powerSupply.EnableOutputs(); //Enable outputs powerSupply.SetVoltage(voltage); //Set voltage string actualVoltage = powerSupply.ReadActualVoltage(); //Read voltage if ((actualVoltage != "") && (voltage == Convert.ToInt32(actualVoltage))) //Compare voltages { Console.WriteLine("Power Supply BKPrecision 9132B over Com port works correctly."); } else { Console.WriteLine("The set and actual voltage is not equal."); } powerSupply.Disconnect(); //Disconect from COM port }