フィルターのクリア

How to upload 2 libraries (Servo and Ultrasonic) to use Matlab with arduino

4 ビュー (過去 30 日間)
Doug Leaffer
Doug Leaffer 2024 年 4 月 9 日
回答済み: Manikanta Aditya 2024 年 4 月 17 日
a=arduino('/dev/cu.usbserial-14230','Nano3','Libraries','Servo') This code will work for the servos for the robot. This code includes the Com port for an Apple computer. I want to use the Ultrasonic Library in addition to the Servo Library, but can't get get it to work in the program. I have tried to add the library to the code above and I have tried to load the two libraries separately.
Has anyone been able to load multiple libraries?
  2 件のコメント
Manikanta Aditya
Manikanta Aditya 2024 年 4 月 10 日
Yes, you can load multiple libraries in MATLAB for use with Arduino. You can do this by including the names of the libraries in a cell array. Here is an example of how you can modify your code to include both the ‘Servo’ and ‘Ultrasonic’ libraries:
a = arduino('/dev/cu.usbserial-14230', 'Nano3', 'Libraries', {'Servo', 'Ultrasonic'});
Hope this helps!
Doug Leaffer
Doug Leaffer 2024 年 4 月 17 日
Excellent ! This worked. Thank you

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

採用された回答

Manikanta Aditya
Manikanta Aditya 2024 年 4 月 17 日
Yes, you can load multiple libraries in MATLAB for use with Arduino. You can do this by including the names of the libraries in a cell array. Here is an example of how you can modify your code to include both the ‘Servo’ and ‘Ultrasonic’ libraries:
a = arduino('/dev/cu.usbserial-14230', 'Nano3', 'Libraries', {'Servo', 'Ultrasonic'});
Hope this helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInstrument Control Toolbox Supported Hardware についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by