-- Settings

-- wifi.PHYMODE_B 802.11b, More range, Low Transfer rate, More current draw
-- wifi.PHYMODE_G 802.11g, Medium range, Medium transfer rate, Medium current draw
-- wifi.PHYMODE_N 802.11n, Least range, Fast transfer rate, Least current draw 
wifi_signal_mode = wifi.PHYMODE_N

left_pin = 2
right_pin = 3

maxspeed = 50
minspeed = 800

maxrssi = -40
minrssi = -100

function compute_speed(rssi)
    speed=maxspeed
    -- Normalize
    theval=rssi
    if rssi < minrssi then
        theval=minrssi
    end
    if rssi > maxrssi then
        theval=maxrssi
    end
    speed=minspeed+(theval-minrssi)*(maxspeed-minspeed)/(maxrssi-minrssi)
    return speed
end

-- max strength
current_rssi=0
function findmax(t) -- (SSID : Authmode, RSSI, BSSID, Channel)
    max=-200
    for ssid,v in pairs(t) do
        local authmode, rssi, bssid, channel = string.match(v, "([^,]+),([^,]+),([^,]+),([^,]+)")
        rssi = tonumber(rssi)
        if rssi > max then
            max = rssi
        end
    end
    print("MAX=",max)
    current_rssi = max
    speed=compute_speed(max)
    print("SPEED=",speed)
end

-- Init

-- Connect to the wifi network
wifi.setmode(wifi.STATION) 
wifi.setphymode(wifi_signal_mode)

rssi_alarm=1
tmr.alarm(rssi_alarm,5000,1,function()
  wifi.sta.getap(findmax)
end)

-- GPIO
gpio.mode(left_pin, gpio.OUTPUT)
gpio.mode(right_pin, gpio.OUTPUT)

-- Run

blink_alarm=0
tmr.stop(blink_alarm)
tmr.unregister(blink_alarm)

lighton=0
blinkspeed=minspeed
function blinking()
    if lighton==0 then
        lighton=1
        gpio.write(left_pin, gpio.HIGH)
        gpio.write(right_pin, gpio.HIGH)
    else
        lighton=0
        gpio.write(left_pin, gpio.LOW)
        gpio.write(right_pin, gpio.LOW)
    end
    tmr.stop(blink_alarm)
    tmr.unregister(blink_alarm)
    blinkspeed=compute_speed(current_rssi)
    tmr.alarm(blink_alarm,blinkspeed,1,blinking)
end
tmr.alarm(blink_alarm,blinkspeed,1,blinking)

Source