Created
April 26, 2021 02:20
-
-
Save futureshocked/6601c649cff6598e508195703ed5695b to your computer and use it in GitHub Desktop.
This script shows how to control an LED with FIO4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| LJ - 10.50 - FIO4_blink.py | |
| This script shows how to control an LED with FIO4. | |
| Components | |
| ---------- | |
| - LabJack T4 | |
| - LED | |
| - Cathode (short pin) to GND | |
| - Anode (long pin) to FIO4 | |
| - Wires | |
| - Breadboard | |
| Course | |
| ------ | |
| Data acquisition and automation with LabJack | |
| https://app.techexplorations.com/courses/labjack/ | |
| ''' | |
| from labjack import ljm | |
| import time | |
| # Open first found LabJack | |
| handle = ljm.openS("ANY", "ANY", "Peter_T4") | |
| info = ljm.getHandleInfo(handle) | |
| print("Opened a LabJack with Device type: %i, Connection type: %i,\n" | |
| "Serial number: %i, IP address: %s, Port: %i,\nMax bytes per MB: %i" % | |
| (info[0], info[1], info[2], ljm.numberToIP(info[3]), info[4], info[5])) | |
| name = "FIO4" | |
| state = 1 | |
| while True: | |
| ljm.eWriteName(handle, name, state) | |
| print("\nSet %s state : %f" % (name, state)) | |
| state = not state | |
| time.sleep(0.5) | |
| # Close handle | |
| ljm.close(handle) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment