I have a LM35 sensor connected to my Pi using the MCP3204(12bit ADC). To read the values I found a python wrapper for the Spi protocol called py-spidev.
I am following tutorials which uses use the MCP3008 Here is the function that reads the value from the sensor.
def readadc(adcnum):
if adcnum > 7 or adcnum < 0:
return -1
r = spi.xfer2([1, 8 + adcnum << 4, 0])
adcout = ((r[1] & 3) << 8) + r[2]
return adcout
My question is Should I be changing something if I am using a 12 bit ADC?