Is it possible to receive data from Matlab using Bluetooth?

Hello,

I want to receive data from Matlab via Bluetooth, but it seems not possible because my mobile phone doesn't support SPP. I read somewhere that I could make it with a MIT App Inventor Bluetooth extension but I don't know how. Did anyone have the same problem? How can I receive data from Matlab?

The data I need to receive is a list of 1, 2 and 3s. My app is a game where I control a character. This character is going to jump, go to the left and go to the right depending if It detects a 1, 2 or a 3 from the list. It means the app needs to read 1 by 1 the digits from a .txt. So, in case the connection with Matlab is not possible (forget about the Bluetooth connection), How could I store the numbers of the .txt (now in my mobile phone), for example in a list, and read them 1 by 1 with a delay?

Thanks in advance!

How do you expect to communicate with the Matlab software is running on your computer. Perhaps you can communicate with Matlab using FTP to get your list of data. What you seem to need to do is get your Android to read a file that resides on your PC.

Where did you find this in formation that you could receive Matlab data via Bluetooth?

Perhaps what you need to do is explained in this search

https://www.google.com/search?q=matlab+from+bluetooth&rlz=1C1CHBF_enUS887US887&oq=matlab+from+bluetooth&aqs=chrome..69i57j69i61l2j69i60.7487j0j7&sourceid=chrome&ie=UTF-8

Hi Steve,

When I install the app in my mobile phone, my intention is to connect the app with my computer via Bluetooth and send some data that I'm acquiring and then proccesing in Matlab, trying to make it kind of "real time system", that is why I thought about communicating via Bluetooth.

About that search, there appears what I said previously, my device does not support SPP, so I can't establish conection.

About this, here is the link:

I don't know if It would be possible to create an extension with this because this is my first contact with Java and App Inventor and I need some help.

Did you read that " * On the Android phone you will probably need to run an application that initiates the service over SPP." and you do not have that capability on your phone.

That means to me you cannot use the implied method in that post. I suggested FTP to communicate with your PC instead of BlueTooth. There are several extensions that use FTP (File Transfer Protocol) that might be able to read Mathlab created files stored on your PC.

You need to understand how App Inventor works. Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles

How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also look here App inventor espa├▒ol. Offline. Tutorial. Ejemplos. Instalaci├│n. C├│digos. Juegos. Curso gratis de App inventor. and here Tutorial Index | imagnity for more tutorials.

Learn about components Component Reference
and visit the Library The MIT App Inventor Library: Documentation & Support Help>Library on the MENU

So why do you need Matlab? App Inventor can do something like you described,'

Put them in a List and read them using one of the Control Blocks

.cycleAList

and a Clock. Exactly what you do depends on your List and what happens when you cycle each item.

Thanks a lot for your replies.

Because my idea is to control the character by biosignals, doing 3 different moves with my hand to get different amplitudes and be able to differentiate them from each other. For that I have to take the samples, process the signals and characterize them with 3 numbers depending on the amplitude.
That is why I need Matlab because We are talking about 400 numbers, I took one sample every 100 ms and every time I start the game I am going to have new samples/numbers.

I hope you understood me :sweat_smile:

About the FTP solution, if I want a "real time game" I guess is not the best option but I am going to take a look anyway because It would be helpful in the second scenario that I described in the first post.

You might use the AccelerometerSensor tool to generate your List of hand attitude position and it might work. It would be difficult to have AI interpret that pattern (guess why you are suggesting Matlab to analyze the data stream)

This article describes a very sophisticated version of what you seem to want to do using an Accelerometer (but not App Inventor) https://www.sciencedirect.com/science/article/pii/S1877050919321672

So, that is not a lot.

Your complex game might be possible using App Inventor.

Keep on experimenting. :slight_smile:

3 Likes

Thank you so much Steve :smiley: