Multiple uart connections #2460
Replies: 5 comments
-
Posted at 2018-02-16 by @gfwilliams Hi! I think it's really just Bluetooth connections from the Puck itself that are the issue. At the moment you can only have one connection at a time - but I guess you only need to change the state of the light occasionally? If so, you could disconnect from the Puck and connect to the light only when you needed to change it? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-16 by Pi @gfwilliams I am trying to have 2 pucks controlling each one bulb. One puck is taking instructions from Node-Red dashboard on the Raspberry Pi, and it must relay the instruction to the other puck. I need all the system to react instantly, power-consumption is not important. What will be the faster way, do you think I should use advertising-scanning between the 2 pucks and have each puck have a constant uart connection with the bulbs? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-19 by @gfwilliams Maybe you could try connecting to the bulb and getting the services and characteristics, and then keeping a reference to the I know you say 'instant', but that's actually really speedy and might make things a lot easier for you. If power usage isn't a big deal then yes, I'd say use scanning for advertising packets - and then the 'middle' Puck can set its advertising data up to relay what it received to the second one. It should be pretty straightforward to implement, even with a continuous connection to the light bulb. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-19 by Pi @gfwilliams thanks a lot for your time. I am using the code on Controlling Bluetooth Lights with Puck.js to control the bulb. Can you please elaborate on how to keep a reference to the characteristic variable. By instant I wanted to say more like having the 2 bulbs turning on/off at the same time I spent some (newbie) hours with advertising/scanning, couldn't make NRF.setScan() work at all, got some success with NRF.findDevices(), but it takes around 2 seconds to turn on/off the bulb on the scanning Puck2. On Puck1 ('middle') I have this running at some point:
On Puck2, I run this code to scan and use manufacturerData:
Probably (surely) I am approaching the whole issue the wrong way, but that's all I came up with that worked. The value 500 and 600 are random, I tried different values without any difference I could tell. Any suggestions how to speed things up? Thanks. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-20 by @gfwilliams This seems to work for me:
You could increase the advertising interval for setAdvertising which would help a lot:
In terms of fast connection, try something like this:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-02-16 by Pi
Hi. Is it possible for the puck to control at the same time another puck and a magic blue light? I am using the code from here (the faster version) and here, but I get error "BLE task 5 is already in progress". Is it possible to have 2 uart connection (if that is the right term) at the same time? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions