Created
February 12, 2015 15:16
-
-
Save gorhgorh/022859ee97190e91754a 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 SensorTag = require('sensortag'); | |
console.log("looking for a sensorTag"); | |
SensorTag.discover(function(sensorTag) { | |
console.log("found one"); | |
sensorTag.connect(function() { | |
console.log("connected to sensortag"); | |
sensorTag.discoverServicesAndCharacteristics(function() { | |
console.log("characteristics discovered"); | |
sensorTag.notifySimpleKey(function() { | |
console.log('simplekey notify correctly set up'); | |
}); | |
}); | |
sensorTag.on('simpleKeyChange', function(left, right) { | |
if (left) { | |
console.log('left pressed'); | |
} else if (right) { | |
console.log('right pressed'); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment