Skip to content

Commit

Permalink
Update pin-pull.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mittalshravika authored Jul 26, 2017
1 parent 4c10eba commit 63c852e
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions pin-pull.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ pin.pull(pullType,(error, buffer) => {
if (error){
throw error;
}

});

pin.read(function(error, number){

if (error) {
throw error;
}

console.log(number);
if (number == 1){
led.off();
}
else{
led.on();
setInterval(function toggle() {
pin.read(function(error, number){

if (error) {
throw error;
}

});
console.log(number);
if (number == 1){
led.on();
}
else{
led.off();
}

});

}, 2000);

0 comments on commit 63c852e

Please sign in to comment.