from machine import Pin from time import sleep_ms PORTA = [16,17,18,19,20,21,22,26] for i in range(0, len(PORTA)): PORTA[i] = Pin(PORTA[i],Pin.OUT) def display(): X = '' n = len(PORTA) for i in range(0, n): X += str(PORTA[n-i-1].value) print(X) def BinaryOut(X): for i in range(0, len(PORTA)): if(X & (1 << i)): PORTA[i].value(1) else: PORTA[i].value(0) for i in range(0, 65535): BinaryOut(i) display() sleep_ms(50) BinaryOut(0)