Avatar for Mr.Peu

Mr.Peu

Member since Jun 2015 • Last active May 2023
  • 3 conversations
  • 20 comments

Pico backer

Most recent activity

  • in ESP8266
    Avatar for Mr.Peu

    Ok, thanks 👍

  • in ESP8266
    Avatar for Mr.Peu

    Salut @azer, what's your status?

  • in General
    Avatar for Mr.Peu

    Great! I'll try this solution first then.

  • in General
    Avatar for Mr.Peu

    It is soldered with the shim. Everything is going to be ok :)
    But maybe I should order a backup Espruino and ESP, just in case...

  • in General
    Avatar for Mr.Peu

    Thanks. The USB TTL should arrive soon.
    Gordon wrote it is "quite difficult". Does he mean complex or risky (big chance of frying something)?

  • in General
    Avatar for Mr.Peu

    0018000902-AI03

    I'm ordering a USB-TTL converter and will upgrade. Thanks. I read the ESP page too fast:

    If you don't have the 0018000902-AI03 firmware version, make sure you
    change the baud rate and Module Name in the code examples below.

    So I concluded that it was all right for me.

    But now I see in the table is written for 0018000902-AI03:

    This was the version sent on boards that came with the Espruino Pico
    KickStarter. It's quite old now, and is known have quite a few bugs.

    Thank you @DrAzzy

  • in General
    Avatar for Mr.Peu

    Hi,

    I am still trying to have my Pico+ESP8266 act as simple HTTP server. It has been working last week (inconvenient of having this only as a hobby project :/ ) but now I keep getting this error.

    I used http://www.espruino.com/Interactive+Web+­UI to kick start my code. It still is pretty close to it. The first request I make works, but the second always triggers this error:

    Here, as seen in the Web IDE's console:

    GET /
    GET /
    ERROR: Socket error -1 while sending
    Uncaught Error: > not registered at line 2 col 64 ...Error(key+" not
    registered");
    ^
    in function "unregister" called from line 7 col 26
    at.unregister('>');
    ^
    in function "callback" called from line 4 col 40
    if (callback && (n=callback(d))) {
    ^
    in function "lineCallback" called from line 29 col 27
    lineCallback(l);
    ^
    in function called from system

    Code:

    var wifi;
    
    function connectWifi(){
      
      Serial2.setup(9600, { rx: A3, tx : A2 });
      
      wifi = require("ESP8266WiFi").connect(Serial2, function(err) {
        if (err) throw err;
        wifi.reset(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");
            // print IP address
            wifi.getIP(console.log);
            // Create a server
            require("http").createServer(pageHandler­).listen(80);
          });
        });
      });
      
    }
    
    
    function pageHandler(req, res) {
      console.log(req.method,req.url);
      if (req.method=="POST") {
          res.writeHead(200);
          res.end('POSTHOME');
      } else if (req.method=="GET") {
        if (req.url=="/") {
          res.writeHead(200);
          res.end('GEThome');
        } else {
          res.writeHead(404);
          res.end("404: Not found");
        }
      } else if (req.method=="OPTIONS") {
        if (req.url=="/") {
          res.writeHead(404);
          res.end();
        }
      }
    }
    
    connectWifi();
    

    I spent several hours looking for the origin of the error, as well as its cause with no luck. Does someone recognise it?

    • 6 comments
    • 3,998 views
  • in JavaScript
    Avatar for Mr.Peu

    res.on('close', fn) works. Thank you @Gordon.

Actions