Хм... В примере куча ошибок синтаксиса...
Попробуйте так:
var vz_options = {
'keyID': 'MY KEY ID',
'keySecret' : 'MY KEY SECRET',
'id' : 'example'
};
//Connect to the Vizibles platform
var cloud = require('Vizibles').init(Serial2, function (d) {
cloud.connect(vz_options, null, connected);
});
//Define some functions to be called from the cloud
var lightOn = function(d) {
//Turn on the LED
digitalWrite(LED2,1);
//Publish the change to the cloud
cloud.update({status : 'on'});
};
var lightOff = function(d) {
//Turn off the LED
digitalWrite(LED2,0);
//Publish the change to the cloud
cloud.update({status : 'off'});
};
//publish those functions once connected
var connected = function(d) {
cloud.expose('lightOn', lightOn, function (d) {
if (d == 'Ok') {
cloud.expose('lightOff', lightOff, function (d) {
if (d != 'Ok') {
connected();
}
});
} else {
connected();
}
});
};