filter.lua
otii.clear()
otii.writeln("Creating project...")
local project = otii.create_project()
assert(project ~= nil, "Cannot create project")
local devices = otii.get_devices("Arc")
assert(#devices > 0, "No available devices")
local box = otii.open_device(devices[1].id)
assert(box ~= nil, "No available otii")
local filter = otii.create_filter("downsampling", 10)
box:add_channel_filter("mc", filter)
box:set_main_voltage(3.0)
box:set_range("low")
box:set_max_current(0.5)
box:enable_channel("mc", true)
otii.writeln("Capturing data...")
project:enable_main_power(true)
project:start()
otii.msleep(10000)
project:stop()
project:enable_main_power(false)
local filename = string.format("%s/capture_%s.otii",
otii.get_otii_dir(),
os.date("%Y%m%d%H%M%S"))
project:save(filename)
project:close()
box:close()