-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update version of i2c dependency in package.json, added feature for p…
…ullup resistors on gpio
- Loading branch information
1 parent
24217ed
commit 0be64b9
Showing
6 changed files
with
134 additions
and
61 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var MCP23017 = require('node-mcp23017'); | ||
|
||
var mcp = new MCP23017({ | ||
address: 0x20, //all address pins pulled low | ||
device: '/dev/i2c-1', // Model B | ||
debug: false | ||
}); | ||
|
||
mcp.pinMode(0, mcp.INPUT_PULLUP); | ||
mcp.pinMode(1, mcp.INPUT_PULLUP); | ||
mcp.pinMode(2, mcp.INPUT_PULLUP); | ||
mcp.pinMode(3, mcp.INPUT_PULLUP); | ||
mcp.pinMode(4, mcp.INPUT_PULLUP); | ||
mcp.pinMode(5, mcp.INPUT_PULLUP); | ||
mcp.pinMode(6, mcp.INPUT_PULLUP); | ||
mcp.pinMode(7, mcp.INPUT_PULLUP); | ||
mcp.pinMode(8, mcp.INPUT_PULLUP); | ||
mcp.pinMode(9, mcp.INPUT_PULLUP); | ||
mcp.pinMode(10, mcp.INPUT_PULLUP); | ||
mcp.pinMode(11, mcp.INPUT_PULLUP); | ||
mcp.pinMode(12, mcp.INPUT_PULLUP); | ||
mcp.pinMode(13, mcp.INPUT_PULLUP); | ||
mcp.pinMode(14, mcp.INPUT_PULLUP); | ||
mcp.pinMode(15, mcp.INPUT); // this one should float from time to time | ||
|
||
setInterval(function(){ | ||
|
||
var test = function(i){ | ||
return function(err, value){ | ||
if(value == false){ | ||
console.log("Pull down on pin " + i, value); | ||
} | ||
} | ||
} | ||
|
||
for (var i = 8; i < 16; i++) { | ||
mcp.digitalRead(i, test(i)); | ||
} |
This file contains 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
This file contains 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