Search code examples
pythonraspberry-piraspbianadafruitadafruit-circuitpython

ModuleNotFoundError: No module named 'Adafruit'


I was working with a code I found online, it had:

from Adafruit import ADS1x15

...
t = time.perf_counter() - t0
adc.stopContinuousConversion()
print('Time elapsed: %.9f s.' % t)
print()

But it kept showing me this error:

Traceback (most recent call last):
File "C:\Users\Aryannn\Downloads\project\child.py", line 15, in <module>
from Adafruit import ADS1x15
ModuleNotFoundError: No module named 'Adafruit'

I am a bit new to Raspberry Pi so I bought it here to ask. It would be really great if you help me out here


Solution

  • I'm guessing you're looking for the python library Adafruit's ADS1x15.

    From https://github.com/adafruit/Adafruit_Python_ADS1x15, it looks to be deprecated. In its place, it's supposedly https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15.

    That said, if you do need to use the current version, I believe it is:

    # Import the ADS1x15 module.
    import Adafruit_ADS1x15
    
    
    # Create an ADS1115 ADC (16-bit) instance.
    adc = Adafruit_ADS1x15.ADS1115()