add example for DAC0/1
would be nice if labjack would also provide an example for DAC0/1, as this is not the case, I did one on my own. Published here as help for others
under Labjack T7 I got DAC0/1 working with this example:
from labjack import ljm
print(ljm.__version__)
class labjack_T7_dac:
def __init__(self):
# Open Labjack T7 device, Any connection, Any identifier
self.handle = ljm.openS("T7", "ANY", "ANY")
def write_dac(self, dac0: float = 0, dac1: float = 0):
if (0 <= dac0 <= 5.0) and (0 <= dac1 <= 5.0):
self.aDAC = ["DAC0", "DAC1"]
self.aValueDAC = [dac0, dac1]
self.numFrames = len(self.aDAC)
ljm.eWriteNames(self.handle, self.numFrames, self.aDAC, self.aValueDAC)
else:
print("DAC values out of range")
def close(self):
ljm.close(self.handle)
def main(self):
self.write_dac(5.0,1.2)
self.close()
if __name__ == '__main__':
c = labjack_T7_dac()
c.main()
The DACs are one of the easiest features to use. There is no configuration, just write to the register. We provide examples like eWriteName.py and eWriteNames.py to demonstrate generally how to write registers. They also both set a DAC.
I am worried that our documentation was not sufficient. Was DAC usage not clear?
Hi Davel,
As there was an example for ADC, I was also expecting an example for DAC..
As you see, I was able to figure it out and provided the example here, so that others just can use it, without going through documentation ;-)
Thanks for bringing this to our attention. I will look into adding a DAC example that supports all T-series devices.