MilkCocoa = require('milkcocoa'); var spi = SPI.initialize("/dev/spidev0.0"), MCP3002 = Buffer([0x68, 0]); var milkcocoa = new MilkCocoa(“xxxx.mlkcca.com"); setInterval(function() { spi.transfer(MCP3002, MCP3002.length, function (e,d) { if (e) console.error(e); else { var v = ((d[0]<<8) + d[1]) & 0x03FF console.log(v, "Got ¥""+v.toString()+"¥" back."); milkcocoa.dataStore('light').push({v : v}); } }); }, 5000);