The following information is for the EMANT300

Turn on and off the LEDs Portwise

Learn:

  • Digital Output
  • LED

The Digital Port is written portwise ie 8 bits at a time using the USB DAQ Training Kit

WritePort_USB.py

import emant import time m = emant.Emant300() # Windows m.Open("COM5",dev="300") # Ubuntu # m.Open("/dev/ttyUSB0",dev="300") print m.HwId() count = 0 while count < 8: m.WriteDigitalPort(count) count += 1 time.sleep(1) m.Close()

Code Explained

m.WriteDigitalPort(count)

The output bits are determined by the count value
8 – 0000 0111 all LEDs are turned off
7 – 0000 0110 only Green LED is turned on
0 – 0000 0000 all LEDs are turned on

m.Open("COM5",dev="300")

For Windows, get serial port using diagnostic.exe

m.Open("/dev/ttyUSB0",dev="300")

For Ubuntu, get serial port using the following

$ dmesg | grep tty [ 0.000000] console [tty0] enabled [ 849.395479] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0