• Hi @jakub.frydrych

    o setup wifi as station connected your access point (only once)

    var Wifi = require("Wifi");
    Wifi.connect( "your SSSID",{password:"your password"}, function(err) {
        if (err) {
            console.log("error connecting to your SSID:",err);
        }
        else {
            Wifi.stopAP();
            Wifi.setConfig({powersave : "none"});  // optional    
            Wifi.save();  // this saves all your Wifi settings
            console.log("Wifi.getIP:", Wifi.getIP());
         }
    }
    
    

    o write code you want to be started on boot='init' and upload

    E.on('init', function() {
    	  // add your code here
    	  ......
    });
    
    

    o after your code is completely uploaded run save, this will save, restart and run your code

    
    save();
    
    
  • Hi, thaks for answear.

    I test this tip and after restart device ( use func reset() ), device not loaded code from init function. What I do wrong ?

    Testing code for init func :

    E.on('init', function() {
          console.log("Device started");
    });
    

    And console output, after save(); code correctly loaded, but after reset() not load code from init function. If I call load() func after reset, code correctly run.

    Connected
    >
    >
    =undefined
    Wifi.getIP: {
      "ip": "10.0.0.42",
      "netmask": "255.255.255.0",
      "gw": "10.0.0.138",
      "mac": "5c:cf:7f:24:77:e4"
     }
    >
    =undefined
    >
    =undefined
    Erasing Flash.....
    Writing....
    Compressed 27200 bytes to 2026
    Checking...
    DDevice started
    >reset();
    =undefined
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v89 Copyright 2016 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
    > 
    
About