@@ -35,15 +35,15 @@ Usage Example
3535============= 
3636
3737
38- Single Ended
39- ------------ 
38+ MCP3008  Single Ended
39+ ---------------------  
4040
4141.. code-block :: python 
4242
4343    import  busio 
4444    import  digitalio 
4545    import  board 
46-     from  adafruit_mcp3xxx.mcp3008 import   MCP3008  
46+     import  adafruit_mcp3xxx.mcp3008 as   MCP  
4747    from  adafruit_mcp3xxx.analog_in import  AnalogIn 
4848
4949    #  create the spi bus 
@@ -52,42 +52,95 @@ Single Ended
5252    #  create the cs (chip select) 
5353    cs =  digitalio.DigitalInOut(board.D5) 
5454
55-     #  create the mcp object from MCP3008 class  
56-     mcp =  MCP3008(spi, cs) 
55+     #  create the mcp object 
56+     mcp =  MCP . MCP3008(spi, cs) 
5757
5858    #  create an analog input channel on pin 0 
59-     chan =  AnalogIn(mcp, MCP3008 .pin_0 ) 
59+     chan =  AnalogIn(mcp, MCP .P0 ) 
6060
6161    print (' Raw ADC Value: '  
6262    print (' ADC Voltage: ' +  str (chan.voltage) +  ' V'  
6363
6464
65- 
66- ------------ 
65+ MCP3008  Differential
66+ --------------------  
6767
6868.. code-block :: python 
6969
7070    import  busio 
7171    import  digitalio 
7272    import  board 
73-     from  adafruit_mcp3xxx.mcp3008 import   MCP3008  
74-     from  adafruit_mcp3xxx.differential_analog_in  import  DifferentialAnalogIn  
73+     import  adafruit_mcp3xxx.mcp3008 as   MCP  
74+     from  adafruit_mcp3xxx.analog_in  import  AnalogIn  
7575
7676    #  create the spi bus 
7777    spi =  busio.SPI(clock = board.SCK , MISO = board.MISO , MOSI = board.MOSI ) 
7878
7979    #  create the cs (chip select) 
8080    cs =  digitalio.DigitalInOut(board.D5) 
8181
82-     #  create the mcp object from MCP3008 class  
83-     mcp =  MCP3008(spi, cs) 
82+     #  create the mcp object 
83+     mcp =  MCP . MCP3008(spi, cs) 
8484
85-     #  create a differential analog input  channel with pin  0 and pin  1 
86-     chan =  DifferentialAnalogIn (mcp, MCP3008 .pin_0,  MCP3008 .pin_1 ) 
85+     #  create a differential ADC  channel between Pin  0 and Pin  1 
86+     chan =  AnalogIn (mcp, MCP .P0,  MCP .P1 ) 
8787
8888    print (' Differential ADC Value: '  
8989    print (' Differential ADC Voltage: ' +  str (chan.voltage) +  ' V'  
9090
91+ 
92+ --------------------- 
93+ 
94+ .. code-block :: python 
95+ 
96+     import  busio 
97+     import  digitalio 
98+     import  board 
99+     import  adafruit_mcp3xxx.mcp3004 as  MCP  
100+     from  adafruit_mcp3xxx.analog_in import  AnalogIn 
101+ 
102+     #  create the spi bus 
103+     spi =  busio.SPI(clock = board.SCK , MISO = board.MISO , MOSI = board.MOSI ) 
104+ 
105+     #  create the cs (chip select) 
106+     cs =  digitalio.DigitalInOut(board.D5) 
107+ 
108+     #  create the mcp object 
109+     mcp =  MCP .MCP3004(spi, cs) 
110+ 
111+     #  create an analog input channel on pin 0 
112+     chan =  AnalogIn(mcp, MCP .P0, MCP .P1) 
113+ 
114+     print (' Raw ADC Value: '  
115+     print (' ADC Voltage: ' +  str (chan.voltage) +  ' V'  
116+ 
117+ 
118+ -------------------- 
119+ 
120+ .. code-block :: python 
121+ 
122+     import  busio 
123+     import  digitalio 
124+     import  board 
125+     import  adafruit_mcp3xxx.mcp3004 as  MCP  
126+     from  adafruit_mcp3xxx.analog_in import  AnalogIn 
127+ 
128+     #  create the spi bus 
129+     spi =  busio.SPI(clock = board.SCK , MISO = board.MISO , MOSI = board.MOSI ) 
130+ 
131+     #  create the cs (chip select) 
132+     cs =  digitalio.DigitalInOut(board.D5) 
133+ 
134+     #  create the mcp object 
135+     mcp =  MCP .MCP3004(spi, cs) 
136+ 
137+     #  create a differential ADC channel between Pin 0 and Pin 1 
138+     chan =  AnalogIn(mcp, MCP .P0, MCP .P1) 
139+ 
140+     print (' Differential ADC Value: '  
141+     print (' Differential ADC Voltage: ' +  str (chan.voltage) +  ' V'  
142+ 
143+ 
91144
92145
93146============ 
0 commit comments