# how many bytes we need to fit this many bits, (+7)/8
rgbdata = (c_ubyte * ((len(data_py) + 7) >> 3))(0)
# array to bits in byte array
for i in range(len(data_py)):
if data_py[i] != 0:
rgbdata[i >> 3] |= 1 << (i & 7)
pin = 2
dwf.FDwfDigitalOutDataSet(hdwf, c_int(pin), byref(rgbdata), c_int(len(data_py)))
Question
abia
data_py = [0 0 1 0 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 0 1 0 1 1]
#print(data_py)
dwf.FDwfDigitalOutInternalClockInfo(hdwf, byref(hzSys))
# how many bytes we need to fit this many bits, (+7)/8
rgbdata = (c_ubyte * ((len(data_py) + 7) >> 3))(0)
# array to bits in byte array
for i in range(len(data_py)):
if data_py[i] != 0:
rgbdata[i >> 3] |= 1 << (i & 7)
pin = 2
dwf.FDwfDigitalOutDataSet(hdwf, c_int(pin), byref(rgbdata), c_int(len(data_py)))
#print("Writing...")
dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))
time.sleep(1)
dwf.FDwfDigitalOutConfigure(hdwf, False)
I've been playing around with the time.sleep but that's definitely not gonna be precise enough.
Most of the above is sample code i believe from custom digital out.
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now