Closed jamborloi closed 5 years ago
you can set the address in init https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/blob/master/adafruit_ads1x15/ads1x15.py#L60 in circuitpython you dont pass the busnumber into the object, you create a bus device separately then pass it in, there's only one on the raspi: https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/i2c-sensors-and-devices
Hi Ladyada, Thanks you for the reply and thanks for the Adafruit libraries. If I will use 2 or 3 ADS1115 in my circuit how to set it up on my python commands? Previously I am setting it up by: adc0 = Adafruit_ADS1x15.ADS1015(address=0x49, busnum=1) adc1 = Adafruit_ADS1x15.ADS1015(address=0x48, busnum=1) On the init I can only change the address.
Thanks
drop busnum, you don't need to specify it.
ok thanks.
And don't forget to use the ADDR pin to set different addresses for each board: https://learn.adafruit.com/adafruit-4-channel-adc-breakouts/assembly-and-wiring#multiple-boards-2-14
Hey Thanks. I will do that.
Hi @ladyada @caternuson , Sorry to bring this up again, I am trying to update my existing system reading temperature from ADS1115. I want to upgrade my circuit with 4 ADS1115 to read 16 temperature and pressure sensors. Ad I am currently using the old script and below is the script to identify all 4: adc0 = Adafruit_ADS1x15.ADS1115(address=0x48) adc1 = Adafruit_ADS1x15.ADS1115(address=0x49) adc2 = Adafruit_ADS1x15.ADS1115(address=0x4A) adc3 = Adafruit_ADS1x15.ADS1115(address=0x4B) *this is on one python script
How can I adapt this on new circuitpython?
Thank you and regards,
That looks fine. In general, you specify the address when you create the object. Looks like that is what you are doing. Is it not working?
That looks fine. In general, you specify the address when you create the object. Looks like that is what you are doing. Is it not working?
Hi, Thanks. I haven't tried it yet. I am wondering how to include it or modify the adafruit circuitpython simpletest python script. In the script it called the adc "ads = ADS.ADS1115(i2c)" Im not sure how to put the i2c address? Or is it like this? ads0 = ADS.ADS1115(i2c, address=0x48) ads1 = ADS.ADS1115(i2c, address=0x49) ads2 = ADS.ADS1115(i2c, address=0x4A) ads3 = ADS.ADS1115(i2c, address=0x4B)
Thanks for your help.
That's it. You're setting the address with the parameter address=
. So ads0
is 0x48
, etc. If you don't specify an address, it just uses a default value.
Do you think it would help if the simpletest example had this in it?
# Create the ADC object
ads = ADS.ADS1015(i2c) # use the default address
#ads = ADS.ADS1015(i2c, address=0x49) # specify an address
hey @caternuson, Ok I understand now. I will try soon, thank you.
Yes it would be very helpful if the simpletest had this specially a noob like me:
ads = ADS.ADS1015(i2c) # use the default address
Want to try and make a pull request with those changes? If you've never made a pull request before, this would be an excellent one to try.
We even have a few guides that might help. https://learn.adafruit.com/an-introduction-to-collaborating-with-version-control/overview https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github/overview
Hi @caternuson , Thanks. I will check and try to pull request with those chages.
Last time you can chose to read which address like this: adc = Adafruit_ADS1x15.ADS1015(address=0x49, busnum=1)
how about this library for ADS1115?