adafruit / Adafruit_CircuitPython_ADS1x15

CircuitPython drivers for the ADS1x15 series of ADCs.
MIT License
133 stars 58 forks source link

QUESTION: what is correct syntax for ADS1115 object without doing "import as" module renaming #65

Closed jrbrearley closed 3 years ago

jrbrearley commented 3 years ago

The example below works fine:

    import board, busio
    import adafruit_ads1x15.ads1115 as ADS
    i2c_1 = busio.I2C(board.SCL, board.SDA)
    ads10 = ADS.ADS1115(i2c_1, address=0x48)

I am trying to avoid using "import as" and use full length class names so I get a better understanding of class structure and who calls what.

    import adafruit_ads1x15.ads1115 # works
    ads10 = adafruit_ads1x15.ads1115(i2c_1, address=0x48) # NameError: name 'adafruit_ads1x15' is not defined
    ads10 = adafruit_ads1x15.ads1115.ADS1115(i2c_1, address=0x48)  # NameError: name 'adafruit_ads1x15' is not defined

Could you please show me the correct syntax?

ladyada commented 3 years ago

hihi please post to the adafruit circuitpython forums for help with python syntax 👍 this place is for bug reports forums.adafruit.com