-
• #2
Check out http://www.espruino.com/Saving
you need to put your code in an
onInit
function (or ideally actually wait until you know WiFi is connected with http://www.espruino.com/Reference#l_Wifi_connected). -
• #3
Thanks i use onInt with settimeout now its working
-
• #4
@user88627, using a
setTimeout()
to wait for Wifi to become connected is a cludge tower... It will come crashing down sooner or later, that's no question... use callback technique instead...
user88627
Hi
I am using NodeMcu with espruino_1v96 .
I write a program in debugging mode its working fine . when same program write in NodeMcu using save();
program is not working .
here is my Code
var led = new Pin(D4);
var host = "192.168.0.103";
var WebSocket = require("ws");
var ws = new WebSocket(host,{
path: '/',
port: 8000, // default is 80
protocol : "echo-protocol", // websocket protocol name (default is none)
protocolVersion: 13, // websocket protocol version, default is 13
origin: 'Espruino',
keepAlive: 60,
headers:{ some:'header', 'ultimate-question':42 } // websocket headers to be used e.g. for auth (default is none)
});
ws.on('open', function() {
console.log("Connected to server");
});
ws.on('message', function(msg) {
var data = JSON.parse(msg);
digitalWrite(led, data.bulb?1:0);
});
save();