Single Procedure for two similar functions

Dear All,
can we have a single procedure with parameters for two functions…

Have you tried it? Did it work? If it worked, then yes. :wink:

I’m trying with any component…

This example should point you in the right direction:

image

Yes, i’m passing an variable (x i.e channel number) to procedure… But confused with any component with Bluetooth. Basically i didn’t for component in that…

Doubts in Mit APP inventor 17
i don’t understand for component & of component, But i will study on that. Any tutorial link is helpful.

the component is the last block in the corresponding drawer, for example BluetoothClient1 or BluetoothClient2

see also How to work with the advanced features

Taifun


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

Tried it.


“The operation select list item cannot accept the arguments”, Where i’m going wrong…

you might want to provide the complete error message...
also how to you call the procuedure and how did you define BT_Devices?

you might want to do a bit of renaming...
for example a better name for x would be index and to avoid errors, let me suggest to prefix list variables always with list... so listBtClient rather than BTClient etc.

Taifun

The operation select list item cannot accept the arguments: , [[com.google.appinventor.components.runtime.BluetoothClient@3cb11d7, com.google.appinventor.components.runtime.BluetoothClient@304ac4]], [package NaN]


BT_Devices is the list containing the list of bluetooth uuid’s.

how did you create the variable index and why is it of blue color?
drag the variable index from here
Unbenannt
Taifun

as I can see, you used a numeric number block and renamed it to index…
Unbenannt2
@ewpatton this is a bug and should not be possible …

Taifun

4 Likes

Thanks, it worked. I’m very sorry for the mistake.
Can we connect Bluetooth client using a name instead of UUID’s, So that we can hard-code in an APP.

don't worry, you found a bug...

I'm not sure, it's already a few years since I played around with the bluetooth components, you might want to try it and let us know, what you find out

http://ai2.appinventor.mit.edu/reference/components/connectivity.html#BluetoothClient

Taifun

Yes a good one.
If you type a word in a maths number block and press enter, it goes back to 0.
If you type a word in a maths number block, then click the blocks editor…:slight_smile:
mathindex

This is a known issue, see here:

1 Like

Good eyes!

http://www.appinventor.org/bookChapters/chapter21.pdf

from the Books and Tutorials FAQ

Note that this is just a visual glitch. I inspected the contents of the block and it still records 0, it just doesn’t update the text to display that the validation failed. If you reload the project it should go back to 0. There is an issue filed:

A post was split to a new topic: Can’t select BLE Component from list