import time
from machine import Pin, ADC

# Example weights and biases for a simple linear model
weights = [0.5]  # Example weight
bias = 0.1       # Example bias

# Initialize ADC (Analog-to-Digital Converter) for input
adc = ADC(Pin(26))  # GPIO 26 is the default ADC pin on Pico

def simple_model(input_value):
    # Perform a simple linear transformation
    return weights[0] * input_value + bias

def main():
    while True:
        # Read analog input (0-3.3V)
        raw_value = adc.read_u16()  # Read ADC value (16-bit resolution)
        input_value = (raw_value / 65535) * 3.3  # Convert to voltage (0-3.3V)
        
        # Run inference
        result = simple_model(input_value)
        
        # Print the result
        print("Input Voltage: {:.2f}V, Model Output: {:.2f}".format(input_value, result))
        
        # Wait before the next reading
        time.sleep(1)

if __name__ == "__main__":
    main()
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT