File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 2424from Adafruit_IO import Client , Feed , RequestError
2525
2626# import Adafruit CircuitPython MCP3xxx library
27- from adafruit_mcp3xxx import adafruit_mcp3xxx
27+ from adafruit_mcp3xxx .mcp3008 import MCP3008
28+ from adafruit_mcp3xxx .analog_in import AnalogIn
2829
2930# Set to your Adafruit IO key.
3031# Remember, your key is a secret,
4849
4950# create the cs (chip select)
5051cs = digitalio .DigitalInOut (board .D12 )
52+
5153# create a mcp3008 object
52- mcp = adafruit_mcp3xxx . MCP3008 (spi ,cs )
54+ mcp = MCP3008 (spi , cs )
5355
5456# create an an adc (single-ended) on pin 0
55- adc_single_ended = adafruit_mcp3xxx . AnalogIn (mcp ,0 )
57+ chan = AnalogIn (mcp , MCP3008 . pin_0 )
5658
5759while True :
58- sensor_data = adc_single_ended .value
60+ sensor_data = chan .value
5961
6062 print ('Analog Data -> ' , sensor_data )
6163 aio .send (analog .key , sensor_data )
You can’t perform that action at this time.
0 commit comments