import time from machine import Pin clock = Pin(2) data = Pin(4) SLEEP_TIME = 1 def read_adc(): # Wait for DRDY while data.high(): pass value = 0 for i in range(24): clock.high() time.sleep_us(SLEEP_TIME) value |= data.value() << (23 - i) clock.low() time.sleep_us(SLEEP_TIME) # Shift 3 more bits for i in range(3): clock.high() time.sleep_us(SLEEP_TIME) clock.low() time.sleep_us(SLEEP_TIME) return value while True: value = float(read_adc()) / (2**24-1) print(f"{value:f}") time.sleep(0.1)