Hardware


Shell Lab T1 is general purpose controller with USB socket

Software

Application

Relay on/off random testdownload
-- this lua script runs in T1 controller
-- gpio - Relay on off test
function relay_onoff_test(port, pin)
    local counter=0
    -- init output pin
    -- (high-level trig) output pushpull 0/3.3V
    --gpio.output(port, pin)
    --gpio.on = gpio.set
    --gpio.off = gpio.clr
    -- (low-level trig) switch between input/output modes
    gpio.on = gpio.output
    gpio.off = gpio.input
    -- utils
    function on()
        gpio.on(port,pin)
        led.on(1)
    end
    function off()
        gpio.off(port,pin)
        led.off(1)
    end
    off()
    -- loop begin
    while true do
        delay=math.floor(math.exp(math.random()*8))
        on() sys.delay(delay)
        off() sys.delay(100)
        counter=counter+1
        --print(counter)
    end
end
relay_onoff_test(4,0)  -- PE0