First the Application freezes and crashes after pressing my "Select Bluetooth Device Button" (Device Picker) I don't know if my data from my ESP32 will be received and stored correctly on my FirebaseDB
You are using many logical issues and make the dc to freeze. The was how handled the list picking is not good. You set before picking, timer enabled true. Think alternate logic to make the timer to trigger
Second one you have not handled the block properly. See the red mark also nothing is mentioned in the variable. To avoid this pls use global variable
hmm, I never thought of that. All I want for my project is
When it connects to bluetooth and receives data It'll change the text of the label
so I think I need it to constantly connected through out the process?
1. Button.Connect.Click
BluetoothClient.Connect(address)
2. BluetoothClient.AfterConnecting
set Clock.Enabled to true
3. Clock.Timer
if BluetoothClient.IsConnected
do
set tempText to BluetoothClient.ReceiveText
if tempText ≠ ""
Label.Text to tempText
4. // When user clicks Connect button
when ButtonConnect.Click
do
BluetoothClient.Connect(address) // or use a list picker for device selection
// After successful connection
when BluetoothClient.AfterConnecting
do
set Clock.Enabled to true
// When user clicks Disconnect button (if you have one)
when ButtonDisconnect.Click
do
BluetoothClient.Disconnect
set Clock.Enabled to false
set Label.Text to "Disconnected"
when Clock.Timer
do
if BluetoothClient.IsConnected
do
set tempText to BluetoothClient.ReceiveText
if tempText ≠ ""
set Label.Text to tempText