I'm trying to do a project with the Leap Motion and an ESP8266 E12. I am very new to using the ESP8266. I am trying to connect to the Leap Motion Websocket: located at http://127.0.0.1:6437 but am not able to get a response from the ESP. Ultimately I want to get the hand data from the websocket to control some servos.
here is my code:
var WIFI_NAME = "***";
var WIFI_OPTIONS = { password : "**" };
var wifi = require("Wifi");
wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
if (err) {
console.log("Connection error: "+err);
return;
}
console.log("Connected!");
});
var host = "127.0.0.1";
var WebSocket = require("ws");
var ws = new WebSocket(host,{
path: '/',
port: 6473,
keepAlive: 60
});
ws.on('open', function() {
console.log("Connected to server");
});
127.0.0.1 is the local machine on each device. You need the IP address of the computer running the leap motion server. Usually that's 192.168.x.y on most LAN's.
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.
I'm trying to do a project with the Leap Motion and an ESP8266 E12. I am very new to using the ESP8266. I am trying to connect to the Leap Motion Websocket: located at http://127.0.0.1:6437 but am not able to get a response from the ESP. Ultimately I want to get the hand data from the websocket to control some servos.
here is my code:
var WIFI_NAME = "***";
var WIFI_OPTIONS = { password : "**" };
var wifi = require("Wifi");
wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
if (err) {
}
console.log("Connected!");
});
var host = "127.0.0.1";
var WebSocket = require("ws");
ws.on('open', function() {
console.log("Connected to server");
});
ws.on('message', function(msg) {
console.log("MSG: " + msg);
ws.on('error', function(){
console.log("error");});
});
On my console I receive a Connected message but nothing else after that, not even an error.
I've also attached a link for more information about the Leap Motion WebSocket:
https://developer-archive.leapmotion.com/documentation/javascript/supplements/Leap_JSON.html
Any help would be appreciated on how to get this working.
Thanks