Pixl.js + ESP8266 -> getSerial() not found

Posted on
  • Hey there,

    I'm trying to run the wifi shield example, but I'm getting this error:

    Uncaught Error: Function "getSerial" not found!
     at line 2 col 11
      Serial1.getSerial();
              ^
    in function "go" called from line 48 col 4
    go();
    

    Not sure where to go, I don't see any other errors like this on the forum

    Full Code:

    var WIFI_NAME = "The LAN Before Time";
    var WIFI_PASS = "redact";
    var wifi;
    
    function getPage() {
      require("http").get("http://www.pur3.co.­uk/hello.txt", function(res) {
        console.log("Response: ",res);
        res.on('data', function(d) {
          console.log("--->"+d);
        });
      });
    }
    
    function go() {
      Serial1.setup(115200,{rx:D0,tx:D1});
      Serial1.getSerial();
      wifi = require("ESP8266WiFi_0v25").connect(Seri­al1, function(err) {
        if (err) console.log(err);
        console.log("Connecting to WiFi");
        wifi.connect(WIFI_NAME, WIFI_PASS, function(err) {
          if (err) console.log(err);
          console.log("Connected");
          // Now you can do something, like an HTTP request
          getPage();
        });
      });
    }
    
    function onInit() {
      Terminal.setConsole();
    }
    
    go();
    
  • Hi! Where did you get the example from? I'd have thought for the WiFi shield you'd be using the code from https://www.espruino.com/arduino-esp8266­ - but there's no mention of Serial1.getSerial there.

    Serial1.getSerial(); isn't a function, which is why you get the error - so I think if you just removed that line it'd work.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Pixl.js + ESP8266 -> getSerial() not found

Posted by Avatar for user122293 @user122293

Actions