from gpiozero import MCP3008 from time import sleep #remember to enable SPI in raspi-config > interfaces before you run this the first time #How to wire the MCP3008: https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters/mcp3008 #gpiozero documentation about MCP3008: https://gpiozero.readthedocs.io/en/stable/api_spi.html ldr = MCP3008(channel=0, device=0) while True: print(ldr.value) sleep(0.01)