Are there any code examples for using multiple sensors with the RAK12023/RAK12035?
I see there is code to change the I2C address on a sensor, so I expect I’ll leave one at default and change the other two to something else.
In the code, though, I assume when I instantiate the sensor I’ll have to specify the I2C address - looking through the library, it seems like it supports that.
I’m not 100% sure of the format though.
The declaration in the arduino example for a single sensor:
/** Sensor */
RAK12035 sensor;
So for multiple sensors is it something like the following (assuming I already changed the addresses on sensor2 and 3 with the change address arduino example):
You have to create a separate instance for each of the sensors with their I2C address:
RAK12035 sensor_1; // Using default address 0x20
RAK12035 sensor_2(0x21); // Second sensor set to I2C address 0x21
RAK12035 sensor_3(0x22); // Third sensor set to I2C address 0x22