Hi folks!
I’m kind of new with kodular, I’ve tried a little bit with appinventor, but generally, I’m a seasoned coder.
I’m facing this issue for two days now, and can’t seem to find nor the solution neither a related post anywhere.
I’m making a simple client connection to an arduino HC-05 bluetooth board. I’m successfull with the connection, and the data exchange so far.
The thing is that, when I select a device to connect to from a list view (previously populated with BluetoothClient.Addresses and Names), I’d like to give the user some feedback while the connection get’s established. Something like a label saying “Connecting to HC-05. Please wait”, and/or a circular progress and so. I have the following block, simplified at it’s maximum to only reproduce the problem I’m facing.
The thing is that the screen doesn’t get updated with those changes until the connection is already established, which is kind of useless. What is that I’m doing wrong? I’ve tried this in many variations in the last two days, and every attempt ends in the same result.
One interesting (for me, at least) observation, is that a single label doesn’t get updated inside a loop. Say a “for” loop which counts from 1 to 1000, and a label inside the loopt that reflects the count. It goes straight from 0 on initialization, to 1000 after the loop finishes.
How do I update the screen properly?
Hi cian! Thanks for your answer.
I’ve tried that earlier this evening, before posting here, in a much more simpler way, which consisted precisely in a “for” loop that updated a global variable, and a clock timer set every 100ms. No luck. It really confuses me. It only updates the label once the loop ends. But in the case of the blocks I’ve posted before, it doesn’t even perform the visual changes ‘before’ entering the “call Bluetooth_Client1.Connect”
Perhaps the Connection is happening Sychronosly. So you need to create a proceedure that when the item is selected, it then kicks off the Notifier, and then makes the connection, and then dismisses notifier once connected.
Using the purple blocks. Does that make sense? See the user is picking, and then connecting. You need to intercept the selection, start the notification process, process the selection etc.
Isn’t that what I’m doing? Jajajaj! I tried to do so. That’s why I first set up the labels with the name of the picked device, and after that launch the connection process. But it feels like it gets into a syncronous process, as you say, much faster than it updates the labels.
However, I do not know what a notifier is, so I’ll check on that tomorrow first thing, and hopefully it behaves differently.
I’ll update on the results so to keep the discussion till it gets solved.
Thanks again!
Hello how are you?
I am beginner kodular user and try developp app with esp32, could help me please to tell me wich blocks to use for connecting, scan, data …with kodular thanks!