You are on page 1of 1

Cara mengkoneksikan beaglebone black dengan pir sensor

Connect the '+' pin from the sensor to 'P9_5' of the BeagleBoard in series with a 10kohm resistor as shown on the right. Connect the '-' pin from the sensor to 'P9_1' of the BeagleBoard. Connect the 'AL' pin from the sensor to 'P8_19' of the BeagleBoard in series with a 10kohm resistor as shown on the right. Connect the LED with a 470ohm resistor as shown on the right Click "Run" on the code. Every 2.5 seconds, the console will tell you if there was motion detected. If there was motion detected, the LED will also turn on.

var b = require('bonescript'); var led = "P8_13"; b.pinMode(led, 'out'); b.pinMode('P8_19', b.INPUT); setInterval(checkPIR, 2500); // Checks the Sensor Every 2.5 Seconds function checkPIR(){ b.digitalRead('P8_19', printStatus); } function printStatus(x) { if(x.value === 0){ b.digitalWrite(led, 1); console.log("Motion Detected"); } else{ console.log("No Motion Detected"); b.digitalWrite(led, 0); } }

You might also like