App Designer and Arduino

10 ビュー (過去 30 日間)
Allison McCrady
Allison McCrady 2019 年 2 月 20 日
移動済み: Walter Roberson 2025 年 1 月 19 日
Hi,
I am designing an interface in the App Designer. I have an Arduino board connected to some sensors. I would like to be able to run the interface multiple times, but right now I run it once perfectly and when I click run again it tells me I have an existing connection at my COM port and I need to clear it. I am unsure how to do this as I am very new to app designer! Any help would be greatly appreciated!
Thanks!
  4 件のコメント
Mohammed Yakoob
Mohammed Yakoob 2024 年 9 月 2 日
Hello dear You can use a= arduino(com, Uno); For example to connect and in the another callback a=[]; to clear the port for new connection.
Mohammed Yakoob
Mohammed Yakoob 2025 年 1 月 19 日
移動済み: Walter Roberson 2025 年 1 月 19 日

Hello, I'm facing in problem that the internal buffers is fully and need to clear it, so how I can do this step when I am using arduino () class?

サインインしてコメントする。

採用された回答

Asad Mirza
Asad Mirza 2019 年 2 月 22 日
You could try changing your startup to just this instead.
function startupFcn(app, a)
app.a=arduino(app.port,'uno');
end
Now remove the arduino(app.port,'uno'); line from your RUNButtonPushed(app, event) function.
This way you only create the arduino object once when you startup the app and then after that all you do is send signals with the button. I do not have an arduino nearby to test this on unfortunately.
  3 件のコメント
Asad Mirza
Asad Mirza 2019 年 2 月 26 日
編集済み: Asad Mirza 2019 年 2 月 26 日
Attached you'll find a quick app I wrote that first finds all available COM ports. You then select the port your arduino is connected to from the list and then press connect to link it to the arduino. You can edit this app such that now that you've connected to the Arduino separatly you can do all the plotting afterwards.
I suggest you make like a button on the app that now plots data from any of the input arduino pins but only after you've connected. You can use the uibuton enable property to make plotting impossible unless you've already connected to an arduino.
Arduino_Ex.JPG
Santiago Restrepo Estrada
Santiago Restrepo Estrada 2019 年 6 月 28 日
Hello,
I was wondering how could I integrate this into an existing app.
thank you

サインインしてコメントする。

その他の回答 (2 件)

Kihak Lee
Kihak Lee 2019 年 12 月 28 日
Dear Asad Mirza
I tested your attached files(Arduino_Ex.mlapp) several times. There is a problem in disconnect button.
When push disconnect button, error is happend. I can not fix it.
Plese check your code!
thanks

Mohammed Yakoob
Mohammed Yakoob 2025 年 1 月 19 日

Hello, I'm facing in problem that the internal buffers is fully and need to clear it, so how I can do this step when I am using arduino () class?

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by