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
<!-- This handler is invoked each time that a button push is detected --> | |
<handler path="/buttonValue"> | |
<behavior> | |
<method id="onInvoke" params="container, message"><![CDATA[ | |
// only on a rising edge send a tweet | |
if (button == 0 && message.requestObject == 1) { | |
// This will send a tweet to our twitter account we registered with bip.io: | |
wot.send([ "twitter", { "title": "Tweeting from my Kinoma! on " + new Date()}]) | |
} | |
// save the new value so we can compare with the next rise/fall state |
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
<!-- This handler is invoked each time that a button push is detected --> | |
<handler path="/buttonValue"> | |
<behavior> | |
<method id="onInvoke" params="container, message"><![CDATA[ | |
// These values are the device id, and device token provisioned | |
// with the Apstrata device management api which you can discover | |
// in your Apstrata workbench. | |
apstrata_device_id = 'YOUR APSTRATA DEVICE ID' | |
apstrata_token = 'YOUR APSTRATA DEVICE TOKEN' |
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
// Then connect to the echo service feed | |
wot.connect(function() { | |
// Upon connection to wot.io register a receive hook that will process each | |
// incoming message and dispatch data to the led | |
wot.receive(function(data) { | |
// if we received an empty message we will abort | |
if (! data) return; | |
// The message is and array of format: [ "pin", #, value ] | |
var value = data[2] | |
// When we receive a value from wot.io we turn on the led if it is greater than 0 |
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
// The following credentials are needed to register with the | |
// Apstrata device management service, and configure the wot.io | |
// connection associated with your device: | |
apstrata_api_key = 'PLEASE ENTER YOUR APSTRATA APP KEY/ID HERE' | |
apstrata_secret = 'PLEASE ENTER YOUR APSTRATA APP SECRETE HERE' | |
wot_username = 'PLEASE ENTER YOUR WOTIO USERNAME HERE' | |
wot_token = 'PLEASE ENTER YOUR WOTIO TOKEN HERE' | |
// instantiate a new Apstrata Device management platform interface | |
aps = new apstrata.Apstrata( apstrata_api_key, apstrata_secret, wot_username, wot_token, true) |
NewerOlder