You are reading a single comment by @Pat and its replies. Click here to read the full conversation.
  • Sorry, and to follow up, any ideas why this code does not work ? It's the CC3000 code transplanted (which does work when the CC3000 is behaving). The .248 address is pingable, but port 80 is not there (I did a port scan). No errors reported ..

    E.enableWatchdog(10);
    
    var eth = require("WIZnet").connect();
    eth.setIP({ ip : "192.168.254.248" });
    eth.setIP({ dns : "208.67.222.222" });
    eth.setIP({ gateway: "192.168.254.100" });
    
    
    function onPageRequest(req, res) {
      res.writeHead(200, {'Content-Type': 'text/html'});
      res.write('<html><body>');
      res.write('<p>Button is '+(BTN.read()?'on':'off')+'</p>');
      res.write('<p>Turn LED1 <a href="/on1">on</a> or <a href="/off1">off</a></p>');
      res.write('<p>Turn LED2 <a href="/on2">on</a> or <a href="/off2">off</a></p>');
      res.write('<p>Turn LED3 <a href="/on3">on</a> or <a href="/off3">off</a></p>');
      res.end('</body></html>');
      if (req.url=="/on1") digitalWrite(LED1, 1);
      if (req.url=="/off1") digitalWrite(LED1, 0);
      if (req.url=="/on2") digitalWrite(LED2, 1);
      if (req.url=="/off2") digitalWrite(LED2, 0);
      if (req.url=="/on3") digitalWrite(LED3, 1);
      if (req.url=="/off3") digitalWrite(LED3, 0);
    }
    
    require("http").createServer(onPageReque­st).listen(80);
    
About

Avatar for Pat @Pat started