Get address only from address and names from bluetooth hc-05

hello dears
please help me to get address only from address and names from Bluetooth hc-05
my program is to just select Bluetooth device manual at first time then store address only of hc-05 to connect automatically later when program start up because when i use address of Bluetooth it contain "hc-05" and process not done and get error address of Bluetooth not correct

The Connect method is usually able to understand the format mac address device name
I.e.there is no need to remove the device name

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.



im a new here excuse me if there is someting not correct

the first screen is the usually start up screen so when is the first time the program start user will go to setting then Bluetooth setting and choose the right Bluetooth he will want the program later every start connect automatically by the Bluetooth address saved

  1. you should store Listpicker1.Selection in in TinyDB
  2. switch screens correctly, see also App Inventor Tutorials and Examples: Manager Screen | Pura Vida Apps
  3. some simplification

Generally these are the recommended blocks... lipConnect is a Listpicker
bt-connect

Taifun

sorry pro im do what you show to me exactlly and this what happen


mac address not valid I think cause contain HC-05 because when I write "00:22:04:00:61:A9" manually it work will but what if i change Bluetooth regularly this will be hard

you previously stored the complete list of mac address bluetooth devices in your variable bluetooth_address
most probably you are still using the complete list and try to connect to a device?
what abour providing a screenshot of your updated blocks?
also clear TinyDB before doing another test...
TinyDB.ClearAll

Taifun

generally to get only the mac address use the split at spaces block from the text drawer together with Listpicker1.Selection to get a list of 2 items (the mac address and the device name), then use a select list item block to select the first item, which is the mac address

Taifun

thank you a lot taifun
its done

Most people stay in one screen when using Bluetooth because switching screens breaks connections.

Stacked vertical arrangements work better, one Visible at a time.

no more my friend i make it easy
by reconnect automatically
thanks

That TinyDB1.ClearAll block in the List Picker1 After Picking event looks rash.

What if you want to save something else in TinyDB1 besides that connection tag/value?

You would lose everything else you saved.

Besides, that TinyDB1.StoreValue blocks replaces that tag/value regardless of prior contents.

no i will remove it when the program complete it just a case for saving bluetooth address to insure that there isnt any thing saved from last edit

1 Like