Advertisement
tdrobotica

Proyecto pir

Dec 30th, 2021
1,303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. import time
  2. from machine import Pin  
  3.  
  4. led1 = Pin(12, Pin.OUT)
  5. led2 = Pin(13, Pin.OUT)
  6. sensorPIR = Pin(2, Pin.IN)
  7. led1.value(0)
  8. led2.value(0)
  9.  
  10. while (1):
  11.     if sensorPIR.value():
  12.         led1.value(1)
  13.         led2.value(1)
  14.         time.sleep(1)
  15.     else:
  16.         led1.value(0)
  17.         led2.value(0)
  18.     print(sensorPIR.value())
  19.     time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement