Open shengchiliu opened 4 years ago
Hello @shengchiliu, Thank you for reaching out.
I haven't used this code directly in a couple years so I don't intimately remember the details. I have been using an evolution of this code base that isn't public at this time. I hope to make it public soon. I will probably replace this library with the new one.
That being said, I'm happy to try and help.
You're referencing test.js
, which I see is referenced in the README
file. I see, however, that the file is missing.
Looking around, I see that I have another branch available that does have a file test.js
. Unfortunately, that file is relatively empty.
If memory serves, the main usage is something like this:
var YEI3Space = require('./YEI3Space.js');
var sensor = new YEI3Space('/dev/ttyUSB0');
// Note: you *must* wait between each of the following function calls for the `callback` argument to be called
// Turn on packet headers
sensor.enableResponseHeader({timestamp: true});
// Tell device which regular sensor information we are interested in
sensor.setStreamingOptions([0x01, 0x21, 0x40, ...]);
// Send an update every 100ms, for ever (-1), and start after a 1000ms
sensor.setStreamingTiming(100, -1, 1000);
// Send the command that makes the sensor start streaming data
sensor.startStreaming();
// Handle incoming data
sensor.on('data', data => {
console.log(data)
});
Great repository! It really helps ppl to develop web app based on the 3 Space Sensor. If it is possible, could you be kind to give some instruction how to use this library (YEI3Space.js)? Thanks in advance.