# Sensor de líneas

##### <span style="color: rgb(22, 145, 121);">**Probando la detección de líneas.**</span>

```python
import cyberpi,mbuild

cyberpi.display.show_label("RGB PROBE STATE\nL2:\nL1:\nR1:\nR2:\n", 16, 0, 0, index = 0)

while True:
    l2_line_state = mbuild.quad_rgb_sensor.is_line("L2",1)
    l1_line_state = mbuild.quad_rgb_sensor.is_line("L1",1)
    r1_line_state = mbuild.quad_rgb_sensor.is_line("R1",1)
    r2_line_state = mbuild.quad_rgb_sensor.is_line("R2",1)

    cyberpi.display.show_label(l2_line_state, 16, 30, 18, index = 1)
    cyberpi.display.show_label(l1_line_state, 16, 30, 36, index = 2)
    cyberpi.display.show_label(r1_line_state, 16, 30, 54, index = 3)
    cyberpi.display.show_label(r2_line_state, 16, 30, 72, index = 4)
```

{{@13396#bkmrk-extraido-de-https%3A%2F%2F}}  
Como puedes ver va detectando las líneas en los 4 sensores que tiene :

<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="allowfullscreen" frameborder="0" height="635" src="https://www.youtube.com/embed/6gyT5P1kMw8" title="prueba sensor de líneas en mBot2 con Python" width="357"></iframe>

##### <span style="color: rgb(22, 145, 121);">**Más probatinas...**</span>

En [https://github.com/PerfecXX/Python-mBot2/tree/main/example/mbuild/02-Quad%20RGB%20Sensor](https://github.com/PerfecXX/Python-mBot2/tree/main/example/mbuild/02-Quad%20RGB%20Sensor) puedes descargarte más scripts que visualizan como el sensor puede detectar el color y el brillo. Nosotros aquí sólo te hemos enseñado el último el de detectar la línea.

[![2025-04-30 08_32_43-Python-mBot2_example_mbuild_02-Quad RGB Sensor at main · PerfecXX_Python-mBot2 ·.png](https://libros.catedu.es/uploads/images/gallery/2025-04/scaled-1680-/2025-04-30-08-32-43-python-mbot2-example-mbuild-02-quad-rgb-sensor-at-main-perfecxx-python-mbot2.png)](https://libros.catedu.es/uploads/images/gallery/2025-04/2025-04-30-08-32-43-python-mbot2-example-mbuild-02-quad-rgb-sensor-at-main-perfecxx-python-mbot2.png)