• Hello, I'm trying on ESP8266 Wifi Module. I have recompiled Espruino as described
    here: http://forum.espruino.com/conversations/­258825/ and here : https://github.com/espruino/Espruino

    And installed it to my STM32F4DISCOVERY Device.

    I'm trying those instructions : http://www.espruino.com/ESP8266

    I have done all connections except of 3.3v extra regulator.
    Also, I don't know is my module new or not, I can see a led like element on the board but it is not blinking when I power it up.

    I'm trying this code and getting the error shown below, How can I be sure is it about module? Connection? or Sotware? :

    Serial4.setup(115200, { rx: C11, tx : C10 });
    var wifi = require("ESP8266").connect(Serial4, function() {
      wifi.connect("WiFi_Name","WPA2_Key", function() {
        console.log("Waiting 10 secs for connect...");
        setTimeout(function() {
          require("http").get("http://192.168.1.50­", function(res) {
    
          });
        }, 10000);
      });
    });
    

    Uncaught Error: Field or method does not already exist, and can't
    create it on undefined at line 10 col 2 }); ^ at line 2 col 7
    wifi.connect("Wiffi","WiffiPassword", function() {

       ^ in function called from system
    
  • Right now this isn't going to work for you I'm afraid. As the esp8266 page says, there's only very basic support for it, and that is very flaky - I wouldn't be surprised if what is there has got broken in recent builds.

    Just to add, this is probably a software problem - at least for now... You could try executing the second function using setTimeout rather than the callback.

    If you just want something simple, i'd use the JavaScript ESP8266 driver that's on the forum - it just doesn't have full HTTP support

  • @Gordon thanks for your response.

    I have tried only this code, but result is the same:

    Serial4.setup(115200, { rx: C11, tx : C10 }); 
    var wifi = require("ESP8266").connect(Serial4, function() {   
    wifi.connect("WiFi_Name","WPA2_Key", function() {   
    }); 
    });
    

    I think you are pointing this thread on the forum : http://forum.espruino.com/conversations/­253943/?offset=25
    I'm going to check it.

    Thanks.

  • Thanks! Yes, that's the one...

    You might have luck with:

    Serial4.setup(115200, { rx: C11, tx : C10 }); 
    var wifi = require("ESP8266").connect(Serial4);
    setTimeout(function() {   
    wifi.connect("WiFi_Name","WPA2_Key", function() {   
    }), 10000);
    

    But I'm not sure - and even with that, built in ESP8266 support isn't good right now. The code from the thread will be a lot better.

  • Thanks for your response, but no way, it didn't worked again. I'm giving up for now.
    Here is the error message :

    Uncaught Error: No Acknowledgement  at line 1 col 46 var wifi = require("ESP8266").connect(Serial4);
                                                  ^ Uncaught Error: Field or method does not already exist, and can't create it on undefined  at line 2 col 5 wifi.connect("WiFi_Name","WPA2_Key", function() {
         ^ in function called from system
    
  • I'm sorry to say that, It was about wiring problem. I have verified it, now I can runn all commands but still can't get the IP Address. I will write here my proccess.

    Thanks for all helps.

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

ESP8266 - Uncaught Error: Field or method does not already exist, and can't create it on undefined

Posted by Avatar for fobus @fobus

Actions