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 ECG 2-27 default, with pacing(60BPM, 10mV, 3ms, single pulse) ...', end='')
sys.stdout.flush()

device.reset()
device.set_pacing_rate(60)  # 60BPM
device.set_pacing_amplitude(10)  # 10mV
device.set_pacing_duration(3.0)  # 3.0ms
device.set_pacing_pulse_mode(PacingPulse.SinglePulse.value)
device.set_frequency(1.0)
device.set_amplitude(1.0)
device.set_output_lead(OutputDut.DUT1.value, OutputLead.Lead_RA.value)
device.set_output_function(OutputFunction.Output_ECG2_27.value)

time.sleep(30)

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

print('done')
