-
Download the file sim908.sh
-
type
sh sim908.sh
in your terminal
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
'use strict'; | |
var SPI = require('pi-spi'); | |
var spi = SPI.initialize("/dev/spidev0.0"); | |
// Read value from a MCP3002 (http://ww1.microchip.com/downloads/en/DeviceDoc/21294C.pdf) | |
function readMCP(channel, callback) { | |
if (spi === undefined) return; | |
var mode = (8 + channel) << 4; |