Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var b = require('bonescript');
- var led = "P8_13";
- b.pinMode(led, 'out');
- b.pinMode('P8_19', b.INPUT);
- setInterval(checkPIR, 5500); // Checks the Sensor Every 5.5 Seconds
- function checkPIR(){
- b.digitalRead('P8_19', printStatus);
- }
- function printStatus(err, x) {
- if(err === 1){
- b.digitalWrite(led, 0);
- console.log("No Motion Detected");
- }
- else{
- console.log("Motion Detected");
- b.digitalWrite(led, 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement