def _handle_led(self): # LED is on when any battery is being discharged any_enabled = False for dic in self.channels: if dic.get('enabled'): any_enabled = True self.dacq.getFeedback(u3.LED(State=any_enabled))
def turnLEDon(d): d.getFeedback(u3.LED(State = True))
def turnLEDoff(d): d.getFeedback(u3.LED(State = False))
def LED(d,on_or_off = True): #If on_or_off is True, then the LED will turn on. d.getFeedback(u3.LED(State = on_or_off))
def set_LED(self, state=1): self.u.getFeedback(u3.LED(State=state))
def __init__(self): if P.labjacking and P.labjack_available: self.labjack = u3.U3() self.labjack.configU3() self.labjack.getFeedback(u3.LED(State=False))
#!/usr/bin/python # LabJack demonstration # # Blink the U3's status LED until the AIN0 input exceeds a limit value. # # Source code from the book "Real World Instrumentation with Python" # By J. M. Hughes, published by O'Reilly. import u3 import time u3d = u3.U3() LEDoff = u3.LED(0) LEDon = u3.LED(1) AINcmd = u3.AIN(0, 31, False, False) toggle = 0 while True: # blink the LED while looping if toggle == 0: u3d.getFeedback(LEDon) toggle = 1 else: u3d.getFeedback(LEDoff) toggle = 0 inval = u3d.getFeedback(AINcmd)[0] print inval if inval > 40000: