Instantly share code, notes, and snippets.

Embed
What would you like to do?
var Cylon = require('cylon');
Cylon.robot({
connections: {
server: { adaptor: 'mqtt', host: 'mqtt://mqtthostname:port',username:'youruserame',password:'yourpasscode' },
arduino: { adaptor: 'firmata', port: 'COM3' }
},
devices: {
button1: { driver: 'button', pin: 7, connection: 'arduino' }
},
work: function(my) {
my.server.subscribe('hello');
my.server.on('message', function (topic, data) {
console.log(topic + ": " + data);
});
my.button1.on('push', function() {
console.log("Saying hello. bUtton pushhed..");
//my.server.publish('hello', 'hi there');
});
}
}).start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment