-
Notifications
You must be signed in to change notification settings - Fork 16
Updates examples #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
These are sensors that use |
Yes indeed. |
The current |
Thanks closing this then 👍🏼 |
We could still update the example offerings though. Maybe something like this?
|
Oh yes I love the idea, will work on that :) |
OK, reopened and renamed. I think there was a good scan example in that other issue thread? |
yes there is, I did example for the fakerequests, i was thinking something similar |
Even simpler, something like: import board
import adafruit_tca9548a
tca = adafruit_tca9548a.TCA9548A(board.I2C())
for channel in range(8):
if tca[channel].try_lock():
print('Channel {}:'.format(channel), end='')
tca[channel].scan()
tca[channel].unlock() Weird - I thought I had dumped something like that over in that PR #32 thread, but not seeing it now. Oh well. Easy enough to rewrite. Output would look something like:
Could maybe make it a little fancier and do a list comp on the return to filter out the TCA's address. |
Will do |
Can you please output the addresses in Hex? |
yes:) we like hex in the I2C world :) |
import board
import adafruit_tca9548a
i2c = board.I2C()
tca = adafruit_tca9548a.TCA9548A(i2c)
for channel in range(8):
if tca[channel].try_lock():
print('Channel {}:'.format(channel), end='')
addresses = tca[channel].scan()
print([hex(address) for address in addresses if address != 0x70])
tca[channel].unlock()
|
New example is desired to show the user how to add two or more sensors
The text was updated successfully, but these errors were encountered: