Thanks again @attila!
Adding dwf.FDwfDigitalOutReset(hdwf) made all the difference. After some more debugging I can now toggle one of the relays back and forth, next step is now to add measurements with the scope channels.
Here is the working relay-toggler if you or anyone else are interested:
dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf))
def send5mspulse(hdwf, ch):
dwf.FDwfDigitalOutRunSet(hdwf, c_double(0.005)) # 5ms run
dwf.FDwfDigitalOutEnableSet(hdwf, c_int(ch), c_int(1))
dwf.FDwfDigitalOutIdleSet(hdwf, c_int(ch), c_int(1)) # 1=DwfDigitalOutIdleLow, low when not running
dwf.FDwfDigitalOutCounterInitSet(hdwf, c_int(ch), c_int(1), c_int(0)) # initialize with high when running
dwf.FDwfDigitalOutCounterSet(hdwf, c_int(ch), c_int(0), c_int(0))
dwf.FDwfDigitalOutRepeatSet(hdwf, c_int(1)) # once
def enable5V(hdwf):
dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(0), c_int(0), c_double(True)) # enable positive supply
dwf.FDwfAnalogIOChannelNodeSet(hdwf, c_int(0), c_int(1), c_double(5.0)) # set voltage to 5 V
dwf.FDwfAnalogIOEnableSet(hdwf, c_int(True)) # master enable
time.sleep(0.1)
enable5V(hdwf)
send5mspulse(hdwf, 6)
send5mspulse(hdwf, 7)
#"run/trigger"
dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))
#do clever measurements with relays in first position here
time.sleep(1)
dwf.FDwfDigitalOutReset(hdwf) # to clear previous instrument configuration, channels are by default in high impendance
enable5V(hdwf)
send5mspulse(hdwf, 14)
send5mspulse(hdwf, 15)
dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))
#do clever measurements with relays in second position here
time.sleep(1)
dwf.FDwfDigitalOutReset(hdwf)
dwf.FDwfDeviceCloseAll()