sarahghp / p5bots

Use your microcontroller with p5.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FIRMATA WIFI ESP8266

rahul-thakoor opened this issue · comments

hey there, is there a way to use this library with esp8266 running wifi firmata? I mean not using serial but instead use etherport client?

There is not currently. I would like to add it — perhaps over the summer — but graduate school has made development on this slow. I would also love a PR for this. hint, hint

commented

Any progress? I would also really want to control it from wifi or lan or bluettooth whatever is the easiest for you.

commented

this project is kinda dead, you could try to use something like p5.dom and johnny five. It would be a bit harder but that's the way it is

Yes, I am pretty taken with other things these days. PRs welcome, tho.

commented

i did a little bit of research and it seems like the only thing we need to do is to use etherport.

var Etherport = require("etherport");
var Board = require("firmata");
var board = new Board(new Etherport(3030));

board.on("ready", () => {
  // esp is ready to communicate
});

That should be all we need to do, appart from making a way to select one of the two

edit: the etherport is saying it does only support ethernet but according to firmata.js it isn't

commented

i don't know how johnny-five code is related to normal firmata but maybe we can also do it like this:

var EtherPortClient = require("etherport-client").EtherPortClient;
var five = require('johnny-five');
var board = new five.Board({
 port: new EtherPortClient({
   host: "192.168.0.221",
   port: 3030
 }),
 timeout: 1e5,
 repl: false
});
commented

i will try to test it myself once i have an esp2866 but that will take some time.

commented

this should do the trick but we need to add a dependency for etherport and we need a good way to change between serial and wifi.

commented

are you okay with a comment "do this do enable wifi" or do you want a dedicated setting for the server?

edit: if normal etherport doesn't work i/you should try etherport-client

Thanks for looking into all this! I think it would be better to let people toggle between wifi and serialport with an optional flag. Once you have a chance to test that it works, open the PR and I can merge and update the new version on npm?