L.S.,
We have recently purchased a caravan. The manufacturer of this caravan has a ‘smart home’ system, which will set you back like 600 euro’s, if you want all options.
So i purchased a seeeed roun display and a couple of xiao nrf52840 devices and a bunch of sensors. Most of them are bluetooth, some aren’t, which will get fitted with their own XIAO, to become a bluetooth sensor.
So in the end I have a set of sensors, all bluetooth. Individually i can read them all using code.
I have:
2x water level, 6x temperature, 2x tire pressure, weight sensor (for propane level) and a fill sensor (toilet waste water). Later on some voltage sensors might be added, as well as a current sensor.
The idea is now to make one xiao with the round display, show everything and possibly providing a bluetooth interface for a phone app to connect to.
As stated, I have the individual parts working. This took some finagling, as there are almost no examples reading another bluetooth device, almost all code is for sending, not for reading. Also the temperature sensors I bought didn’t work at first, and needed reprogramming with an alternative firmware.
Now my question; how is one supposed to handle multiple connections to several bluetooth devices.
For instance, I get my device by:
BLE.scanForAddress("38:1f:8d:be:6e:7c");
peripheral = BLE.available();
This peripheral, is it re-usable. As in say I do:
BLE.scanForAddress(addr1);
peripheral1 = BLE.available();
BLE.scanForAddress(addr2);
peripheral2 = BLE.available();
peripheral1.connect();
// do something
peripheral1.disconnect();
peripheral2.connect();
//do something
peripheral2.disconnect;
and so forth?
There’s also the subscribe() method to a characteristic. Logically that would lead me to believe I can subscribe to several characteristics over several devices, and then recieve callbacks when they are updated/changed/ready to read.
Anyone got anything on this?