LED
Colores
Podemos fijar los colores de los leds de Cyberpi con este código
import cyberpi
# R G B Position
cyberpi.led.on(255,0,0,id=1)
cyberpi.led.on(255,255,0,id=2)
cyberpi.led.on(255,255,255,id=3)
cyberpi.led.on(0,255,0,id=4)
cyberpi.led.on(0,255,255,id=5)
Extraído de https://github.com/PerfecXX/Python-mBot2/blob/main/README.md licencia MIT
Intermitencia
Podemos encender y apagar a voluntad
import cyberpi
from time import sleep
while True:
# R G B Position
cyberpi.led.on(255,0,0,id=1)
cyberpi.led.on(255,255,0,id=2)
cyberpi.led.on(255,255,255,id=3)
cyberpi.led.on(0,255,0,id=4)
cyberpi.led.on(0,255,255,id=5)
sleep(1)
# Position
cyberpi.led.off(id='all')
sleep(1)
Extraído de https://github.com/PerfecXX/Python-mBot2/blob/main/README.md licencia MIT
Arco Iris
import cyberpi
"""
Name List (str)
rainbow , spoondrift , meteor_blue , meteor_green ,
flash_red , flash_orange , firefly
"""
cyberpi.led.play(name = "rainbow")
Extraído de https://github.com/PerfecXX/Python-mBot2/blob/main/README.md licencia MIT
Movimiento leds
import cyberpi
from time import sleep
cyberpi.led.on(255,0,0,id=1)
while True:
# shift all the colors 1 step to the right.
# (If it is negative, it will be left shifting.)
cyberpi.led.move(1)
sleep(1)
Extraído de https://github.com/PerfecXX/Python-mBot2/blob/main/README.md licencia MIT
No Comments