• Hi,

    I want to connect my Pico to the internet with an ESP8266-12f.

    When I send and save() the code using the Web IDE it's fine but then if I disconnect it and power it up with a usb power supply, it doesn't work.

    function onInit() {
      Serial1.setup(115200, { rx: B7, tx : B6 });
      var wifi = require("ESP8266WiFi_0v25").connect(Serial1, function(err) {
        if (err) throw err;
        wifi.reset(function(err) {
          if (err) throw err;
          wifi.connect("xxx","xxx", function(err) {
            if (err) throw err;
            require("http").get("http://www.pur3.co.uk/hello.txt", function(res) {
              console.log("Response: ",res);
              res.on('data', function(d) {
                console.log("--->"+d);
                if (res.statusMessage == "OK") {LED2.set();}
              });
            });
          });
        });
      });
    }
    

    The Pico's green light should switch on if the http response is OK.

    I tried this way aswell but still no joy.

    E.on('init', function() {
      Serial1.setup(115200, { rx: B7, tx : B6 });
      var wifi = require("ESP8266WiFi_0v25").connect(Serial1, function(err) {
        if (err) throw err;
        wifi.reset(function(err) {
          if (err) throw err;
          wifi.connect("xxx","xxx", function(err) {
            if (err) throw err;
            require("http").get("http://www.pur3.co.uk/hello.txt", function(res) {
              console.log("Response: ",res);
              res.on('data', function(d) {
                console.log("--->"+d);
                if (res.statusMessage == "OK") {LED2.set();}
              });
            });
          });
        });
      });
    });
    
About

Avatar for countxerox @countxerox started