Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlendMicro not read data from node.js #13

Open
qazaqstem opened this issue Sep 2, 2016 · 0 comments
Open

BlendMicro not read data from node.js #13

qazaqstem opened this issue Sep 2, 2016 · 0 comments

Comments

@qazaqstem
Copy link

On blend micro i use SimpleChat.ino. On RPI3 i use https://www.npmjs.com/package/blendmicro this library. Blend micro send data to the node, and rpi3 read this data. If i send data to from blendmicro to the node, node not read. On node i use this code

var BlendMicro = require("#{__dirname}/../../");
// var BlendMicro = require("blendmicro");

var bm = new BlendMicro(process.argv[2]);

bm.on("open", function(){
  console.log("open");
});

bm.on("data", function(data){
  console.log(data.toString());
});

process.stdin.setEncoding("utf8");

// write data from STDIN
process.stdin.on("readable", function(){
  var chunk = process.stdin.read();
  if(chunk == null) return;
  chunk = chunk.toString().replace(/[\r\n]/g, '');
  bm.write(chunk);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant