Guest User

Untitled

a guest
Apr 20th, 2020
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import numpy as np
  2. import time
  3. import pdb
  4. import weakref
  5. from ctypes import *
  6. from nidaqmx import Task
  7.  
  8. import atexit
  9.  
  10. # Simple class that can be used to control one Digital output line
  11. class DO(Task):
  12. def __init__(self, dev):
  13. Task.__init__(self)
  14. self.do_channels.add_do_chan(dev)
  15. self.write(False)
  16. atexit.register(self.clean)
  17.  
  18. def clean(self):
  19. self.low()
  20. self.close()
  21.  
  22. def high(self):
  23. self.write(True)
  24.  
  25. def low(self):
  26. self.write(False)
  27.  
  28.  
  29. if __name__ == '__main__':
  30. dig_0 = DO('/cDAQ1Mod1/port0/line0')
  31. dig_0.high()
  32. time.sleep(5)
  33.  
  34. dig_1 = DO('/cDAQ1Mod1/port0/line1')
  35. dig_1.high()
  36. time.sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment