Setup your MCP3008 objects once, then read the values repeatedly.
This example sets up all 8 objects then repeatedly reads those 8 values:
This example sets up all 8 objects then repeatedly reads those 8 values:
Code:
from gpiozero import MCP3008import time,datetime# setup MCP3008 objectsadcs = []for channel in range(0,8): adcs.append(MCP3008(channel))# display valueswhile True: print(datetime.datetime.now()) for channel in range(0,8): print(channel,adcs[channel].value) print('') time.sleep(1)Statistics: Posted by rpiMike — Mon Feb 03, 2025 10:33 pm