Created
April 20, 2018 15:57
-
-
Save nschairer/1f36e75be5841cb000eeae10938e0046 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs'); | |
| var Bleacon = require('bleacon'); | |
| var UUID = 'your UUID'; | |
| var Major = 'Your Major'; | |
| Bleacon.startScanning(UUID,Major); // scan for ibeacons | |
| var jsonArray =[]; | |
| Bleacon.on('discover', function(bleacon) { | |
| //bleacon properties are: uuid, major, minor, measuredPower, rssi, accu$ | |
| var beacon = JSON.stringify(bleacon); | |
| jsonArray.push(bleacon) | |
| fs.writeFile("test.json",JSON.stringify(jsonArray), function(er$ | |
| if (err) { | |
| return console.log(err); | |
| } | |
| console.log('file saved') | |
| }); | |
| console.log(beacons[bleacon.minor],bleacon.rssi) | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment