Skip to content

Instantly share code, notes, and snippets.

@cgreening
Last active August 29, 2015 14:22
Show Gist options
  • Save cgreening/9b283859a0149fd4922c to your computer and use it in GitHub Desktop.
Save cgreening/9b283859a0149fd4922c to your computer and use it in GitHub Desktop.
Scan for peripherals
nodule.scanForPeripherals(<NAME REGEX>, [<SERVICE UUIDS>]);
// e.g. Scan for all peripherals with names ending in Temperature
nodule.scanForPeripherals(/.*Temperature/);
// e.g. Scan for all peripherals that advertise battery level and heart rate services
nodule.scanForPeripherals(/.*/, ['180F', '180D']);
nodule.on('scan', function(peripherals) {
// peripherals is an array of matching peripherals
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment