You are reading a single comment by @Bennr and its replies. Click here to read the full conversation.
  • Yes I think it's something stupid I'm doing. It connects to the WiFi but just won't get anything.

    I tried substituting the URL for 172.217.169.14 which I think is the ip for google.com but got the same result.

    Thanks,

    Here's my code:

    digitalWrite(B9,1); // enable on Pico Shim V2
    Serial2.setup(115200, { rx: A3, tx : A2 });
    
    const http = require("http");
    
    var wifi = require("ESP8266WiFi_0v25").connect(Seri­al2, function(err) {
      if (err) throw err;
      console.log("Connecting to WiFi");
      wifi.connect(WIFI_NAME, WIFI_PASS, function(err) {
    
        if (err) throw err;
        console.log("Connected");
    
        fetchData();
    
      });
    });
    
    function fetchData() {
      console.log('Fetching data');
      http.get("http://gomako.co.uk/hello.txt"­, function(res) {
      var contents = "";
        res.on("data", function(data) { contents += data; });
        res.on("close", function() { console.log(contents); });
      }).on("error", function(e) {
        console.log("ERROR", e);
      });
    }
    
About

Avatar for Bennr @Bennr started