|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
[FTC]: Using multiple sensors of same type
I got tired of not being able to read two color sensors or two sonic sensors, so I re-wrote the code to get them to work as expected.
In configuration, make sensor "I2C Device". Initialization is hardware map, device name, and configured address. color = new RedStormColorSensor(hwMap, "cb", 0x40); range = new RedStormRangeSensor(hwMap, "rf", 0x2a); |
|
#2
|
||||
|
||||
|
Re: [FTC]: Using multiple sensors of same type
Quote:
|
|
#3
|
|||
|
|||
|
Re: [FTC]: Using multiple sensors of same type
Here is the device I think you are talking about: https://cdn-shop.adafruit.com/datasheets/TCS34725.pdf
I have seen other libraries support it, so I would guess it could. You would have to change RedStormColorSensor.java to match the registers in the datasheet on page 13. Let me know if you have any issues with what the code is doing. |
|
#4
|
|||
|
|||
|
Re: [FTC]: Using multiple sensors of same type
Because the Adafruit color sensors have a fixed, non-changeable I2C address, you need to use an I2C multiplexer. This code I wrote lets you use Adafruit color sensors over a multiplexer.
|
|
#5
|
||||
|
||||
|
Re: [FTC]: Using multiple sensors of same type
Quote:
Thank you . I already have multiplexer and test code (not mine) that worked. I was just asking because original post didn't specify which sensors affected and it would be cool if Adafruit Sensors with fixed I2C address can be used with just code without needing extra hardware |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|