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);
});
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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();