from machine import Pin
sensor = Pin(26, Pin.IN)
#location of the LEDs on the microcontroller
led1 = Pin(15, Pin.OUT)
led2 = Pin(2, Pin.OUT)
led3 = Pin(4, Pin.OUT)
print("If it detects movement, the LEDs will turn on")
#Location of the sensor
sensor = Pin(26, Pin.IN)
while True:
if sensor.value() == 1:
led1.value(1)
led2.value(1)
led3.value(1)
print("a movement was detected")
else:
led1.value(0)
led2.value(0)
led3.value(0)
time.sleep(0.5)