https://drive.google.com/file/d/1BofWWtL7qYXjh_t3pRlO7_p28K9EGO7V/view

from random import randint
from machine import Pin
import time
time.sleep(0.1) # Wait for USB to become ready

print("Hello, Pi Pico!")

pin_id =[1,2,3,4,5,6,7,8,9,10]
pins = []

for i in range(10):
    pins.append(Pin(pin_idx[i]),Pin.OUT)

while True:
    diff = randint(0,7)
    for i in range (diff):
        pins[i].high()
















































from machine import Pin
import utime
 
# Define pin numbers for LED bar
LED_PINS = [1,2,3,4,5,6,7,8,9,10]
 
# Initialize LED pins
leds = [Pin(pin, Pin.OUT) for pin in LED_PINS]
 
# Define function to calculate Hamming distance
def hamming_distance(char1, char2):
    # Convert characters to ASCII values
    char1_ascii = ord(char1)
    char2_ascii = ord(char2)
 
    # Calculate XOR of ASCII values
    xor_result = char1_ascii ^ char2_ascii
 
    # Count number of set bits in XOR result
    distance = 0
    while xor_result:
        distance += xor_result & 1
        xor_result >>= 1
 
    return distance
 
# Function to light up LEDs based on Hamming distance
def visualize_hamming_distance(str1, str2):
    max_distance = max(len(str1), len(str2))
    for i in range(max_distance):
        if i < len(str1) and i < len(str2):
            distance = hamming_distance(str1[i], str2[i])
            # Light up LEDs based on Hamming distance
            for j, led_pin in enumerate(LED_PINS):
                if j < distance:
                    leds[j].on()
                else:
                    leds[j].off()
        else:
            # If one string is shorter than the other, turn off remaining LEDs
            for led in leds:
                led.off()
        utime.sleep(1)  # Pause for 1 second between comparisons
 
# Example usage
string1 = "hello"
string2 = "world"
visualize_hamming_distance(string1, string2)
 
$abcdeabcde151015202530fghijfghij
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT