Skip to content

Instantly share code, notes, and snippets.

@bobvanluijt
Last active March 20, 2016 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobvanluijt/63027e64ab2aec5cc34c to your computer and use it in GitHub Desktop.
Save bobvanluijt/63027e64ab2aec5cc34c to your computer and use it in GitHub Desktop.
What to do with x to draw a horizontal line?
const EtherDream = require('./etherdream.js').EtherDream,
numpoints = 35000;
console.log('Looking for EtherDream hosts...')
EtherDream.findFirst(function(all) {
if (all.length == 0) {
console.log('Didn\'t find any EtherDream on the network.');
return;
}
EtherDream.connect(all[0].ip, all[0].port, function(conn) {
console.log('Connected.');
if (!conn) {
return;
}
function pointStreamer(numpoints, callback) {
var framedata = [];
var x = 0;
for(var k=0; k<numpoints; k++) {
var pt = {};
pt.x = x;
x += 0.1;
pt.y = 0;
pt.r = 32768;
pt.g = 0;
pt.b = 0;
framedata.push(pt);
}
callback(framedata);
}
conn.streamPoints(numpoints, pointStreamer.bind(this));
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment