• @Robin
    'save()' is not affecting anything. Sorry I mentioned it. you can ignore it. I was simply trying to share that it seemed to work for a second or two.

    day 1 - working flawlessly for hours. Went to sleep happy.
    day 2 - not working all day (no changes. getting error: "No 'ready' after AT+RST")
    day 3 - still not working all day. I try different things. No go. try one silly thing. It worked. Did a "Save()" then power cycled it (turned it off then on again) it no longer works. Try a bunch of things and cannot get it to connect to ANY network any time any where.

    Here's the code:

    var WIFI_NAME = "ValidWIfiSSID";
    var WIFI_PASS = "CorrectPassword";
    D9.set(1); // power on
    Serial1.setup(115200,{rx:D0,tx:D1});
    console.log("starting wifi");
    var wifi = require("ESP8266WiFi_0v25").connect(Serial1, function(err) {
      if (err) {
        console.log("oh no" + err);
        throw err;
      }
      LED1.write(1);
      LED2.write(0);
      console.log("Connecting to WiFi");
      wifi.connect(WIFI_NAME, WIFI_PASS, function(err) {
        if (err) throw err;
    
        // I don't get past here. I error out
    
        LED1.write(0);
        LED2.write(1);
        console.log("Connected");
        getPrice(); // I get the price of bitcoin and display it.
        setInterval(function (){
            getPrice(); // get it and display it
        },120000);
    
      });
    });
    
    
  • Damien, my apologies, just don't have enough time right now. Hoping someone else has some ideas.

    In the meantime, some thoughts to process:

    I do see suspicious code L6 and L14 with the nested connect() function. Do you have an example or tutorial link that is being worked from?

    I remember STA and AP mode being an issue for me and several were able to provide ideas that got me running with the 8266. These might give some ideas to try, until someone else is able to respond.

    http://forum.espruino.com/conversations/300549/
    http://forum.espruino.com/conversations/299987/#comment13465364

    Also noticed function getPrice() isn't defined, maybe because of personal security, but could that be locking everything up? Suggestion to place console.log() statements to see if execution progresses passed L21. Comment out L22 and L24 and replace with console.log()

    Is var wifi equal to anything, or is it null/undefined after L14

    L4 are D0 and D1 defined somewhere else and pointing to correctly wired pins? What is the result of pinMode()?

    and, no init() function should save() be used.

About

Avatar for Robin @Robin started