Add pullup option to Arduino digital input

to Close #455
This commit is contained in:
Dave Conway-Jones
2018-06-27 21:36:06 +01:00
parent 76a221919a
commit 88f7f52f99
5 changed files with 15 additions and 4 deletions

View File

@@ -78,6 +78,15 @@ module.exports = function(RED) {
}
});
}
if (node.state === "PULLUP") {
node.board.pinMode(node.pin, 0x0B);
node.board.digitalRead(node.pin, function(v) {
if (v !== node.oldval) {
node.oldval = v;
node.send({payload:v, topic:node.pin});
}
});
}
if (node.state == "STRING") {
node.board.on('string', function(v) {
if (v !== node.oldval) {