Skip to content

Instantly share code, notes, and snippets.

@perusio
Created May 14, 2016 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perusio/fb0115299ee7bb4126dd278c644de547 to your computer and use it in GitHub Desktop.
Save perusio/fb0115299ee7bb4126dd278c644de547 to your computer and use it in GitHub Desktop.
Example of using the Tessel Board with the relayr cloud
/*
* Property: isOn
* Returns: boolean (true or false) if led is on
*
* Checks the led to see if it is on or not.
*/
if (led.isOn)
{
console.log('The green LED is currently on.');
}
client.on('connect', function() {
//subscribe to commands sent from the dashboard or other clients
client.subscribe("/v1/f7396807-18fc-4205-b055-3a6dda680f77/cmd");
client.on('message', function(topic, message) {
});
//simple timer to send a message every 1 second
var publisher = setInterval(function(){
// publish a message to a topic
var data = JSON.stringify({meaning:"analog0", value:fuckingName});
client.publish("/v1/f7396807-18fc-4205-b055-3a6dda680f77/data", data, function() {
});
}, 500);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment