Skip to content

Commit

Permalink
Stop scanning after retrieving scan
Browse files Browse the repository at this point in the history
  • Loading branch information
dcyoung committed Apr 26, 2017
1 parent fa883c3 commit a3f9553
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sweepjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,23 @@ if (require.main === module) {

console.log('Starting data acquisition as soon as motor is ready...');
sweep.startScanning();


console.log('Retrieving 1 scan...');
sweep.scan(function (err, samples) {
if (err) {
return console.log(err);
console.log(err);
return;
}

console.log("Printing samples from first (partial) scan...");
samples.forEach(function (sample) {
var fmt = util.format('angle: %d distance %d signal strength: %d',
sample.angle, sample.distance, sample.signal);
console.log(fmt);
});

console.log('Stopping data acquisition...');
sweep.stopScanning();
});
}

Expand Down

0 comments on commit a3f9553

Please sign in to comment.