File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 24
24
from Adafruit_IO import Client , Feed , RequestError
25
25
26
26
# 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
28
29
29
30
# Set to your Adafruit IO key.
30
31
# Remember, your key is a secret,
48
49
49
50
# create the cs (chip select)
50
51
cs = digitalio .DigitalInOut (board .D12 )
52
+
51
53
# create a mcp3008 object
52
- mcp = adafruit_mcp3xxx . MCP3008 (spi ,cs )
54
+ mcp = MCP3008 (spi , cs )
53
55
54
56
# 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 )
56
58
57
59
while True :
58
- sensor_data = adc_single_ended .value
60
+ sensor_data = chan .value
59
61
60
62
print ('Analog Data -> ' , sensor_data )
61
63
aio .send (analog .key , sensor_data )
You can’t perform that action at this time.
0 commit comments