from ctypes import *
from secg40 import *
import sys
import time

device = SECG40(get_lib_path())

if device.connect(-1, 5000) == False:
    print('Error: device is not connected')
    sys.exit()

ImpedMode = device.get_input_impedance_mode()
if 0 != ImpedMode:
    print('Initial Input Impedance Mode: On (without 620K Ohm impedance)')
else:
    print('Initial Input Impedance Mode: Off (with 620K Ohm impedance)')

amp = c_double(5)
device.set_amplitude(amp)

freq = c_double(10)
device.set_frequency(freq)

device.set_output_function(OutputFunction_E.Output_Sine.value)
print('Output 5mV 10Hz Sine without 620K Ohm impedance signal to measure Reference Vpp')
time.sleep(5)

device.set_output_function(OutputFunction_E.Output_Off.value)
device.set_input_impedance_mode(0)
ImpedMode = device.get_input_impedance_mode()
if 0 == ImpedMode:
    print('Turn off Input Impedance Mode: with 620K Ohm impedance')
device.set_output_function(OutputFunction_E.Output_Sine.value)
print('Output 5mV 10Hz Sine with 620K Ohm impedance signal to measure Comparison Vpp')
time.sleep(5)


device.close()
