View Categories

HC SR501 Pir Motion Sensor Gerak

Persiapan Part: #

– Raspberry Pi Pico / Pico W
– HC SR501 Pir Motion Sensor
– Breadboard
– 3x Kabel Jumper Male to Female
– Kabel Micro USD
– Aplikasi Thonny IDE

Wiring HC SR501 Ke Raspberry Pi Pico
– connect the VCC (power) pin of the sensor with a 5V pin (red wire)
– connect the OUTPUT pin of the sensor to GP22 (yellow wire)
– connect the GND of the sensor to a GND (ground) pin (black cable)

Sample Code #

from machine import Pin
import time
 
pir = Pin(22, Pin.IN, Pin.PULL_DOWN)
n = 0
 
print('Starting up the PIR Module')
time.sleep(1)
print('Ready')
 
while True:
     if pir.value() == 1:
          n = n+1
          print('Motion Detected ',n)
     time.sleep(1)

Hasil yang di tampilkan #

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare
What are you looking for in Partdo?
× How can I help you?