lxi.lua
local args = otii.get_args()
assert(#args < 3, "Too many arguments")
assert(#args == 2, "Provide a IP address to the instrument")
local agilent = args[2]
otii.clear()
otii.writeln("Connecting to instrument...")
local lxi, errormsg = otii.lxi_connect(agilent)
if lxi == nil then
error("Cannot connect to instrument: " .. errormsg)
end
otii.writeln("connected")
local value = lxi:read()
otii.writeln(value)
local result = lxi:get("READ?")
otii.writeln(tonumber(result))
local state = lxi:set("VOLTAGE:RANGE 10")
otii.writeln(state)
lxi:disconnect()