import busio
import digitalio
import board
import adafruit_mcp3xxx.mcp3002 as MCP
from adafruit_mcp3xxx.analog_in import AnalogIn

# create the spi bus
spi = busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)

# create the cs (chip select)
cs = digitalio.DigitalInOut(board.D5)

# create the mcp object
mcp = MCP.MCP3002(spi, cs)

# create an analog input channel on pin 0
chan = AnalogIn(mcp, MCP.P0)

print("Raw ADC Value: ", chan.value)
print("ADC Voltage: " + str(chan.voltage) + "V")

[((8, 6, 8, 66), 'busio.SPI', 'busio.SPI', (), '', False, 'import busio\n'), ((11, 5, 11, 37), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', ({(11, 28, 11, 36): 'board.D5'}, {}), '(board.D5)', False, 'import digitalio\n'), ((14, 6, 14, 26), 'adafruit_mcp3xxx.mcp3002.MCP3002', 'MCP.MCP3002', ({(14, 18, 14, 21): 'spi', (14, 23, 14, 25): 'cs'}, {}), '(spi, cs)', True, 'import adafruit_mcp3xxx.mcp3002 as MCP\n'), ((17, 7, 17, 28), 'adafruit_mcp3xxx.analog_in.AnalogIn', 'AnalogIn', ({(17, 16, 17, 19): 'mcp', (17, 21, 17, 27): 'MCP.P0'}, {}), '(mcp, MCP.P0)', False, 'from adafruit_mcp3xxx.analog_in import AnalogIn\n')]