Created
August 1, 2015 00:08
-
-
Save calderonroberto/7b8b276740de25c73f97 to your computer and use it in GitHub Desktop.
Example using the stsplatform module using callbacks.
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
sts = require('../stsplatform'); | |
// Create a Client. | |
var client = new sts.Client(); | |
// Create a sensor object, referencing the client/ | |
var sensor = new sts.Sensors(client, 'calderonroberto.demo'); | |
// Get the sensor information (print the response code) | |
sensor.get(null, function(error,response){ | |
console.log(">>> Sensor Info"); | |
console.log(response.data); | |
console.log(response.code); | |
}); | |
// Create a Data object using a sensor | |
var data = new sts.Data(sensor); | |
// Print some data (last element) | |
// http://wotkit.readthedocs.org/en/latest/api_v1/api_sensor_data.html#raw-data-retrieval | |
data.get({beforeE:1}, function(error, response){ | |
console.log(">>> Data"); | |
console.log(response.data); | |
console.log(response.code); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment