I keep getting this error...

10 ビュー (過去 30 日間)
Abrahim
Abrahim 2022 年 9 月 17 日
コメント済み: Chris 2022 年 9 月 17 日
I am new to Matlab, and I am trying to create a blinking LED program using an arduino. After I have finished setting up my arduino and my program. I kept encountering the same error and I don't know how to fix it. The error saids, "MATLAB connection to Uno at COM3 exists in your workspace. To create a new connection, clear the existing object".
The following is my program:
a=arduino;
for i=1:10
writeDigitalPin(a,'D13',1);
pause(0.5);
writeDigitalPin(a,'D13',0);
pause(0.5);
end
disp('Done');

回答 (1 件)

Chris
Chris 2022 年 9 月 17 日
編集済み: Chris 2022 年 9 月 17 日
In your workspace, does a already exist, or some other arduino object?
if so, type clear a (or the other relevant object) in the command window. You could put that at the end of your program to try and avoid these errors in the future.
Or, as many do, simply put clear; close all at the beginning of your programs to clean the slate at the start.
  2 件のコメント
Chris
Chris 2022 年 9 月 17 日
You're welcome.

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

カテゴリ

Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by