Created
November 13, 2014 20:16
-
-
Save liorkesos/b41ebf6c4930e6bf6fdc to your computer and use it in GitHub Desktop.
cylon test
This file contains hidden or 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
var Cylon = require('cylon'); | |
// Initialize the robot | |
Cylon.robot({ | |
connection: { name: 'spark',adaptor:'adaptor', accessToken: '3111decfe43f23fc4a45cb51eac70e91c9b509c0', deviceId: '53ff6e066667574847462567', module: 'spark' }, | |
device: { name: 'led', driver: 'led', pin: 'D0' }, | |
work: function(my) { | |
every((1).second(), function() { | |
my.led.toggle(); | |
}); | |
} | |
}).start(); |
node cyapp.js
I, [2014-11-13T20:51:36.931Z] INFO -- : Initializing connections.
I, [2014-11-13T20:51:36.932Z] INFO -- : Initializing connection 'spark'.
I, [2014-11-13T20:51:37.263Z] INFO -- : Initializing devices.
I, [2014-11-13T20:51:37.264Z] INFO -- : Initializing device 'sensor'.
I, [2014-11-13T20:51:37.266Z] INFO -- : Starting connections.
I, [2014-11-13T20:51:37.266Z] INFO -- : Connecting to 'spark'.
I, [2014-11-13T20:51:38.241Z] INFO -- : Starting devices.
I, [2014-11-13T20:51:38.241Z] INFO -- : Starting device 'sensor' on pin A7.
I, [2014-11-13T20:51:38.242Z] INFO -- : Working.
Analog value => null
Analog value => null
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
var Cylon = require('cylon');
// Initialize the robot
Cylon.robot({
connection: { name: 'spark',adaptor:'spark', accessToken: '3111decfe43f23fc4a45cb51eac70e91c9b509c0', deviceId: '53ff6e066667574847462567', module: 'cylon-spark' },
device: {name:'sensor', driver: 'analogSensor', pin: 'A7' },
work: function(my) {
every((1).second(), function() {
analogValue = my.sensor.analogRead();
console.log('Analog value => ', analogValue);
});
}
}).start();