from wecg400 import *

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

print('output Customized ECG (1Hz, 1mV, DUT1, RA, ..) ...', end='')
sys.stdout.flush()

device.reset()
device.set_frequency(1.0)
device.set_amplitude(1.0)
device.set_pwave(1.0)           # P wave 1.0 mV
device.set_pr_interval(200)     # PR interval 200 ms
device.set_p_duration(50)       # P duration 50 ms
device.set_qt_interval(500)     # QT interval 500 ms
device.set_qrs_duration(200)    # QRS duration 200 ms
device.set_twave(1.0)           # T wave 1.0 mV
device.set_output_lead(OutputDut.DUT1.value, OutputLead.Lead_RA.value)
device.set_output_function(OutputFunction.Output_Custom_ECG.value)

time.sleep(10)
device.set_output_function(OutputFunction.Output_Off.value)  # stop output
device.free()

print('done')
