Finding Code Blocks from MIT 1 in MIT 2 (how to pair bluetooth devices)


I am having a hard time replicating the follwing code blocks into MIT 2:

-The "Define Variable" Code Block
-The "Then Do Test" Code Block
-The "If Then Do Test" Code Block
-The "Text Text" Code Block

Does anyone have any idea where I can find the same code but in MIT 2?

As an example, I am trying to "call length" as in the screenshot but can't seem to figure out how in MIT 2.

Hover over the names of the declared variables: "Mac_adress" etc. The set and get blocks will appear.

And in order to just define a variable for example Mac_Adress what do I need: Initialise, Set or Get?

(in order to have it work just like in the screenshot with the code I am trying to adapt for MIT 2)

At the moment I have the variable set up like this, don't know if that's how it needs to be done:


As for comparison blocks: <> =. They are in three places. In Logic, Math and Text.
You click on the arrow next to = and you have a set of functions.

1 Like

That I figured out, but I still can't find out how did they managed to call that length variable or whatever it is, I can't seem to call it. They didn't define it as a variable or anything and it's not an object. How do I do the same in MIT 2 ? As you can see I found the "length" in the text menu but can't seem to find a way to call it.

Thank you!

Do you need a component for bluetoot device names and addresses?

To be honest I just need the pair code behind the button that I created.

I am following this MIT 1 Tutorial:

My App already can scan and connect to my esp32 as long as it's paired and this is why I am trying to adapt the code from that tutorial and add it to my project so I can have a working pair function via the button I created.

I don't exacly get what code from there does the pairing job.

The component you are asking about is a TinyDB renamed

See your link:

  1. TinyDB (Basic -> TinyDB)
  • Rename = db_MACAddress
  1. Notifer (Other stuff -> Notifer)
  • Rename = Notifer

TinyDb with Storage. In my opinion, you should use newer tutorials, not the pre-historic ones :slight_smile:

Yup, I already have those enabled.


My problem is that I don't know which part of the code from the tutorial I need for pairing only, I don't need anything else from there besides the code that brings me to the pairing menu of the phone when the "Pair" button is pressed.

ActivityStarter z Connectivity
Maybe mark in the photo what block you need. Because I really don't know who it is.

I need to call the length and the segment as seen here:

I think you need these blocks:
blocks (72)
MAC addresses can be a list so you need to examine the length of the list. You'll find the segment block in Text.
The pink length block is used to check the length of a text value.

This is my own button that I created for the pairing process and I need to take the pairing code from that tutorial and add it into my project, I took what I could but having problems with the said above "call length" and "call segment" things which I don't know how to find the call function for them in MIT 2. And besides from that I don't exacly know which part of the code from the tutorial is for the pairing process but that's okay I'll figure it out but I need to find a way to manage to call length and segment in my code as well until then.

And how do I call that length segment ? If you look into the MIT 1 code it is being called.

this snippet will not pair the devices, but will open the settings for the user to do the pairing manually
if you want to do that, just use the activity starter with the following settings

  • Action = android.intent.action.MAIN
  • ActivityClass =$BluetoothSettingsActivity
  • ActivityPackage =

as mentioned in that tutorial...
to programmatically pair devices, you will need an extension, see your other thread


You don't name it. You just take it and drag it.

My dear, thank you for your clear answer. I don't mind the procedure, so that's why I want to implement it like this for the moment.

So, I did just that for the Activity Starter, I also added the following blocks for the button code:



The problem is that, when I press the pair button on my phone, I get the following error:

Error Number: 601
Message: No corresponding activity was found,

You might use this extension which supposedly can pair devices, Now this extension is free to everyone----see the bottom part of the discussion of the extension.


this is the correct Action
i.e. remove the "Action =" same for the other items


1 Like