MPL115A2
First, let's import Cylon:
var Cylon = require('cylon');
Now that we have Cylon imported, we can start defining our robot
Cylon.robot({
Let's define the connections and devices:
connections: { arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' } }, devices: { mpl115a2: { driver: 'mpl115a2' } },
Now that Cylon knows about the necessary hardware we're going to be using, we'll tell it what work we want to do:
work: function(my) { my.mpl115a2.getTemperature(function(err, data) { var temp = data['temperature'], pressure = data['pressure']; console.log("temperature " + temp + " pressure " + pressure); }); }
Now that our robot knows what work to do, and the work it will be doing that hardware with, we can start it:
}).start();