Created
May 14, 2016 18:15
-
-
Save perusio/fb0115299ee7bb4126dd278c644de547 to your computer and use it in GitHub Desktop.
Example of using the Tessel Board with the relayr cloud
This file contains 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
/* | |
* 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