How to Hook up a 12C Mux to two RFD77402 distance sensors?

Hi,

I downloaded the example Mux code for the accelerometers and tried to replace the accel info with the distance sensors. But

it calls out for a Shield. When I was ordering the electronics, I was told that I hook up the two sensorswity two 500mm Qwick cables to the Mux and then the Mux to the Red board. Correct?

The second question is in the code The error says Mydistance was not declared?

Generally, anytime you see “was not declared in scope” you’re missing a library for the part you’re trying to compile code for.

I’d recommend starting with on sensor and following our hookup guide to get that running first.

https://learn.sparkfun.com/tutorials/qw … okup-guide

Once you have one sensor running, it shouldn’t be too hard to get two working.

The issue is not the sensors but the code to read the MUX. Since it is on the I2c line it confuses me how to read the data?

Do I define senor 1 & senosr 2 ?

How do I red the dat thry the mux prot?

Regards,

Robert Wootten

What mux are you using? If it’s the Qwiic Mux Breakout, the code in the hookup guide for that has some example code that show how to change ports.

https://learn.sparkfun.com/tutorials/qw … okup-guide

Chris,

Have tried the examples and switched the code for the RFD77402 sensors (2x).

THe Mux is the 8 channel (TCA9548A) 14685.

I cannot get the two sensor to workthru the MUX cos ?

Lost,

Robert

Chris,

I have seen on Arduino a reference to some code called 12c_scanner. Do you knwo where I can get this?

Thanks,

Robert

Have tried the examples and switched the code for the RFD77402 sensors (2x).

THe Mux is the 8 channel (TCA9548A) 14685.

I cannot get the two sensor to workthru the MUX cos ?

Sadly I do not have example code for using those specific sensors with the Qwiic Mux Breakout and that’s something you’re going to need to write on your own. I can tell you that the tab named Mux_Control that loads with the example sketch is where the code that switches ports on the MUX lives. When you call enableMuxPort(x) or disableMuxPort(x) from your main sketch, that will jump into the Mux_Control tab and either enable or disable whatever port you specify.

For example, if you want to read a sensor on port 1, you would enable port one, run the code that reads the sensor and then you would disable port 1. If you were jumping to port 2 next, you’d enable port 2, run the code that reads the sensor on port 2, then when you’re done, disable port 2.

I have seen on Arduino a reference to some code called 12c_scanner. Do you knwo where I can get this?

A google search turns up this link:

[Arduino playground I2C Scanner](Arduino Playground - I2cScanner)