Help with error message….

Home Forums NodeLua firmware Startup Help with error message….

This topic contains 0 replies, has 1 voice, and was last updated by  taldenk 3 years, 7 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #488

    taldenk
    Participant

    I am trying to load a project to toggle led’s. I keep getting the error below. I have gone over the code and all of the () brackets match up. What could this be referring to?

    > [string “”]:30: ‘)’ expected near ‘<eof>’

    Here is my code

    wifi.setmode(wifi.STATION)
    wifi.sta.config(“SSID”,”PASSWORD”)
    print(wifi.sta.getip())
    gpio.mode(2, gpio.OUTPUT)
    gpio.mode(4, gpio.OUTPUT)
    srv=net.createServer(net.TCP)
    srv:listen(80,function(conn)
    conn:on(“receive”, function(client,request)
    local buf = “”;
    local _, _, method, path, vars = string.find(request, “([A-Z]+) (.+)?(.+) HTTP”);
    if(method == nil)then
    _, _, method, path = string.find(request, “([A-Z]+) (.+) HTTP”);
    end
    local _GET = {}
    if (vars ~= nil)then
    for k, v in string.gmatch(vars, “(%w+)=(%w+)&*”) do
    _GET[k] = v
    end
    end
    buf = buf..”<h1> Web Server</h1>”;
    buf = buf..”<p>LIGHT 1 <button>ON</button> <button>OFF</button></p>”;
    buf = buf..”<p>LIGHT 2 <button>ON</button> <button>OFF</button></p>”;
    local _on,_off = “”,””
    if(_GET.pin == “ON1”)then
    gpio.write(2, gpio.HIGH);
    elseif(_GET.pin == “OFF1”)then
    gpio.write(2, gpio.LOW);
    elseif(_GET.pin == “ON2”)then
    gpio.write(4, gpio.HIGH);
    elseif(_GET.pin == “OFF2”)then
    gpio.write(4, gpio.LOW);
    end
    client:send(buf);
    client:close();
    collectgarbage();
    end)
    end)

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.