# Importar librerias
import time
import machine
import utime
import sys
from machine import Pin # libreria de GPIO del RPI PICO 

# Definicion de Fucniones
def dectobin(num):
  textb=""
  ii=128
  for a in range(0,8,1):
    if num & ii ==0:
      textb=textb+"0"
    else:
      textb=textb+"1"
    ii=ii>>1
  return textb

def salp(num,lista):
  for pins in lista:
    Pin(pins,Pin.OUT)
  ii=128
  for pins in lista:
    if ((num & ii) !=0):
      Pin(pins,Pin.OUT).value(1)
    else:
      Pin(pins,Pin.OUT).value(0)
    ii=ii>>1

def main():
  # Configuraciones de recursos
  print("Ejemplo Secuencias")
  if sys.platform == "esp32":
        leds = [21, 19, 18, 5, 17, 16, 4, 2]  # Pines para ESP32 
  elif sys.platform == "rp2":
        leds = [2, 3, 4, 5, 6, 7, 8, 9]  # Pines para Raspberry Pi Pico
  # inicializacion de Variables
  ii=0
  jj=0
  cont=0

  # Bucle infinito
  while True:
    for cont in range(0,256,1):
      print("Contador","=",str(cont)," Binario:", dectobin(cont)  )
      salp(cont,leds)
      time.sleep(0.2)

if __name__=='__main__':
  main()
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT
pico:GP0
pico:GP1
pico:GND.1
pico:GP2
pico:GP3
pico:GP4
pico:GP5
pico:GND.2
pico:GP6
pico:GP7
pico:GP8
pico:GP9
pico:GND.3
pico:GP10
pico:GP11
pico:GP12
pico:GP13
pico:GND.4
pico:GP14
pico:GP15
pico:GP16
pico:GP17
pico:GND.5
pico:GP18
pico:GP19
pico:GP20
pico:GP21
pico:GND.6
pico:GP22
pico:RUN
pico:GP26
pico:GP27
pico:GND.7
pico:GP28
pico:ADC_VREF
pico:3V3
pico:3V3_EN
pico:GND.8
pico:VSYS
pico:VBUS
bargraph1:A1
bargraph1:A2
bargraph1:A3
bargraph1:A4
bargraph1:A5
bargraph1:A6
bargraph1:A7
bargraph1:A8
bargraph1:A9
bargraph1:A10
bargraph1:C1
bargraph1:C2
bargraph1:C3
bargraph1:C4
bargraph1:C5
bargraph1:C6
bargraph1:C7
bargraph1:C8
bargraph1:C9
bargraph1:C10