Skip to content

Instantly share code, notes, and snippets.

@liorkesos
Created November 17, 2014 19:33
Show Gist options
  • Save liorkesos/c2254b7c4a13763863f6 to your computer and use it in GitHub Desktop.
Save liorkesos/c2254b7c4a13763863f6 to your computer and use it in GitHub Desktop.
cylon analog read
var Cylon = require('cylon');
Cylon.robot({
connection: {
name: 'voodoospark',
adaptor: 'voodoospark',
accessToken: '7934611bc6bf91b50c67a4477d2e90bad4b8f561',
deviceId: '53ff6e066667574847462567',
module: 'cylon-spark'
},
/*
device: {
name: 'led',
driver: 'led',
pin: 'D7'
},
*/
device: {
name: 'sensor',
driver: 'analogSensor',
pin: 'A7'
},
work: function(my) {
every((1).second(), function() {
analogValue = my.sensor.analogRead();
console.log('Analog value => ', analogValue);
});
}
}).start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment