# PIR SENSOR MOVIMIENTO

Un bucle para determinar si hay movimiento o no

La instrucción PIN lo encontramos en avanzados:

[![2025-11-04 14_26_13-Configuración.png](https://libros.catedu.es/uploads/images/gallery/2025-11/scaled-1680-/2025-11-04-14-26-13-configuracion.png)](https://libros.catedu.es/uploads/images/gallery/2025-11/2025-11-04-14-26-13-configuracion.png)

[https://makecode.microbit.org/S50667-88978-39987-85757](https://makecode.microbit.org/S50667-88978-39987-85757)

<div id="bkmrk--1" style="position: relative; height: 0; padding-bottom: 70%; overflow: hidden;"><iframe frameborder="0" sandbox="allow-popups allow-forms allow-scripts allow-same-origin" src="https://makecode.microbit.org/#pub:S50667-88978-39987-85757" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>

</div><iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="allowfullscreen" frameborder="0" height="874" src="https://www.youtube.com/embed/9ik_2DTfUcY" title="SENSOR PIR SMART HOME MICROBIT" width="492"></iframe>

##### <span style="color: rgb(22, 145, 121);">**RETOS**</span>

<p class="callout success">RETO1: que muestre lo que detecta por el puerto USB   
ver [https://docs.keyestudio.com/projects/KS4027-KS4028/en/latest/makecode.html#project-4-pir-motion-sensor](https://docs.keyestudio.com/projects/KS4027-KS4028/en/latest/makecode.html#project-4-pir-motion-sensor)</p>

<p class="callout success">RETO2 que si detecta movimiento se encienda el led amarillo  
ver [https://docs.keyestudio.com/projects/KS4027-KS4028/en/latest/makecode.html#project-5-induction-lamp](https://docs.keyestudio.com/projects/KS4027-KS4028/en/latest/makecode.html#project-5-induction-lamp)</p>

<p class="callout success">RETO3 que si detecte que suene una alarma Pista: aquí tienes cómo hacer sonidos [https://libros.catedu.es/books/microbit/page/una-pequena-melodia](https://libros.catedu.es/books/microbit/page/una-pequena-melodia)</p>