advancedAnalogRead.lua
local gainer = require 'gainer'
local board = gainer.new()
local function setup()
board:init()
board:setSamplingMode(gainer.AIN_ONLY) end
local function loop()
board:setGain(gainer.VSS, 1)
print("Minimum gain, VSS reference:", board:analogRead(1))
board:setGain(gainer.VSS, 16)
print("Maximum gain, VSS reference:",board:analogRead(1))
board:setGain(gainer.AGND, 1)
print("Minimum gain, AGND reference:", board:analogRead(1))
board:setGain(gainer.AGND, 16)
print("Maximum gain, AGND reference:",board:analogRead(1))
board:wait(1) end
board:start(setup, loop)