Add examples for MPL115A2
This commit is contained in:
parent
2f7719cf28
commit
6360ed7c09
|
@ -0,0 +1,16 @@
|
|||
Cylon = require '../..'
|
||||
|
||||
Cylon.robot
|
||||
connection:
|
||||
name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0'
|
||||
|
||||
device:
|
||||
name: 'mpl115a2', driver: 'mpl115a2'
|
||||
|
||||
work: (my) ->
|
||||
my.mpl115a2.on 'start', ->
|
||||
my.mpl115a2.getTemperature((data) ->
|
||||
Logger.info "temperature #{data['temperature']}, pressure #{data['pressure']}"
|
||||
)
|
||||
|
||||
.start()
|
|
@ -0,0 +1,15 @@
|
|||
var Cylon = require('../..');
|
||||
|
||||
Cylon.robot({
|
||||
connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' },
|
||||
|
||||
device: { name: 'mpl115a2', driver: 'mpl115a2' },
|
||||
|
||||
work: function(my) {
|
||||
my.mpl115a2.on('start', function() {
|
||||
my.mpl115a2.getTemperature(function(data) {
|
||||
Logger.info("temperature " + data['temperature'] + " pressure " + data['pressure']);
|
||||
});
|
||||
});
|
||||
}
|
||||
}).start();
|
Loading…
Reference in New Issue