1

Im currently trying to set up an ADC (ADS1115) and trying to test it so everything works. Ive used a code from github (link provided at the end) and watched several youtube videos about how to set it up. No matter how I do i either get: "ModuleNotFoundError No module named 'board', then I tried to install the module and get: AttributeError: Module 'board' has no attribute 'SCL'. I provide a picture of the code. At this moment, I have no clue on how to get it fixed... Seems to work when you watch youtube tutorials about it, but not when im trying to implement it. I´ve also tried using the full code, but get the same attribute error.

github link: https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/blob/main/examples/ads1x15_simpletest.py

import time
import board
import busio
import adafruit_ads1x15.ads1015 as ADS
from adafruit.ads1x15.analog_in import AnalogIn

i2c = busio.I2C(board.SCL, board.SDA) ads = ADS.ADS1015(i2c) chan = AnalogIn(ads, ADS.P0)

while True: print(chan.voltage)

Konrado
  • 11
  • 4

2 Answers2

0

I have written an example for my lg library.

There are examples for C and Python (local and remote).

Python local example

joan
  • 71,852
  • 5
  • 76
  • 108
0

I am using a Pi 4 with Raspian (most current version as of 01/2023) and have followed this official guide from Adafruit: https://learn.adafruit.com/adafruit-4-channel-adc-breakouts/python-circuitpython , having it to work perfectly.

Following the guide you will notice that you will have to install CircuitPython and Blinka. All that will only work with Python 3, so be sure to have it as the default python on your machine.

Also, make sure you have your system updated with How do I upgrade Raspbian?