DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

Simply method of control a LED

Hello I must be control a LED with Dasyalab 13 It mus signalise if the messurement is running I will dont use a Boeard with Relais, i Need a simply Methode. i have seen that is possible with the Serialport is possible control 1 ot 2 LEDs what are the methods to control one LED Simpli on Dasylab? Greetings Thomas
0 Kudos
Message 1 of 3
(4,705 Views)

I don't know of a serial port LED.

 

You need a 2-5V output to turn on an LED typically. You should ensure that you protect the LED with a resistor.

 

Many data acquisition devices have Digital I/O. With DASYLab, simply configure your control signal (5V) to a Digital output for your device.

 

When I do DASYLab training, I use a Combi Trigger module for the control and output directly to a MCC USB-204 DO wired with an LED on signal and ground.

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 3
(4,662 Views)

You can use the Script module to open a serial port. Turn on/off the RTS/DTR pins (4 and 7, DE-9) dependent on the incoming data value. The serial library is included in DASYLab's Python.

 

 

Code fragment of a Script module with inputs only:

import serial

...
    def Start (self):
        self.port = None
        try:
            self.port = serial.Serial(port = "COM1",
                                      baudrate = 9600,
                                      bytesize = 8,
                                      parity = serial.PARITY_NONE,
                                      stopbits = serial.STOPBITS_ONE,
                                      timeout = 0, 
                                      xonxoff = 0,
                                      rtscts = 0)            
        except:
            print "Unable to open COM1."
            return False
    #end Start
        

    def Stop (self):
        if self.port and self.port.isOpen():
            self.port.close()
    #end Stop


    def ProcessData (self):        
    ...
        InBuff = self.GetInputBlock(0) # NULL check omitted
        val = int(InBuff[0])
        InBuff.Release()

        if val == 0:
            self.port.setDTR(False) # <-- !
            self.port.setRTS(True)
        else:
            self.port.setDTR(True)
            self.port.setRTS(False)            
            
        
        return True
    #end ProcessData

 

M.Sc. Holger Wons | measX GmbH&Co. KG, Mönchengladbach, Germany | DASYLab, DIAdem, LabView --- Support, Projects, Training | Platinum NI Alliance Partner | www.measx.com
0 Kudos
Message 3 of 3
(4,542 Views)