Created
April 26, 2021 02:26
-
-
Save futureshocked/e6a487e2d98bcb84d8aef667d8cc6f86 to your computer and use it in GitHub Desktop.
This script shows how to control an LED with FIO5 with a Lua script.
This file contains 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 - 09.70 - voltage_follower_verbose.lua | |
This script shows how to control an LED with FIO5 with a Lua script. | |
Components | |
---------- | |
- LabJack T4 | |
- Voltmeter/Multimeter | |
- Multimeter red probe to DAC0 | |
- Multimeter black probe to GND | |
- Potentiometer | |
- Midlle pin to AIN0 | |
- Left pin to VS | |
- Right pin to GND | |
- Wires | |
- Breadboard | |
Course | |
------ | |
Data acquisition and automation with LabJack | |
https://app.techexplorations.com/courses/labjack/ | |
--]] | |
print("Read AIN0 input voltage and set DAC0 output voltage. Update at 10Hz") | |
local InputVoltage = 0 | |
LJ.IntervalConfig(0, 100) --set interval to 100 for 100ms | |
local checkInterval=LJ.CheckInterval | |
local mbRead = MB.R --local functions for faster processing | |
local mbWrite = MB.W | |
while true do | |
if LJ.CheckInterval(0) then --interval completed | |
InputVoltage = mbRead(0, 3) --read AIN0. Address is 0, type is 3 | |
print("AIN0: ", InputVoltage, "V") | |
mbWrite(1000, 3, InputVoltage) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment