Legacy MATLAB and Simulink Support for Arduino

버전 1.15.0.0 (171 KB) 작성자: Giampiero Campa
MATLAB class and Simulink blocks for communicating with an Arduino board
다운로드 수: 242.1K
업데이트 날짜: 2023/10/10

편집자 메모: Popular File 2012 2013 2014 2015 2016 2017 2018 2019 2020

legacy-matlab-and-simulink-support-for-arduino

MATLAB® class and Simulink® blocks for communicating with an Arduino board

View legacy-matlab-and-simulink-support-for-arduino on File Exchange

NOTE: This solution (formerly known as "Arduino IO Package") is no longer supported. It is recommended that you use Arduino support packages that are developed and supported by MathWorks:

Use this legacy support only if one of the following is true:

  • You are using MATLAB R2013b or earlier (but not earlier than R2011a).
  • You are using unsupported Arduino clones which won't work with the official packages (e.g. ChipKit32)

Sample usage:

%-- connect to the board a = arduino('COM9')

%-- specify pin mode a.pinMode(4,'input'); a.pinMode(13,'output');

%-- digital i/o a.digitalRead(4) % read pin 4 a.digitalWrite(13,0) % write 0 to pin 13

%-- analog i/o a.analogRead(5) % read analog pin 5 a.analogWrite(9, 155) % write 155 to analog pin 9

%-- serial port a.serial % get serial port a.flush; % flushes PC's input buffer a.roundTrip(42) % sends 42 to the arduino and back

%-- servos a.servoAttach(9); % attach servo on pin #9 a.servoWrite(9,100); % rotates servo on pin #9 to 100 degrees val=a.servoRead(9); % reads angle from servo on pin #9 a.servoDetach(9); % detach servo from pin #9

%-- encoders a.encoderAttach(0,3,2) % attach encoder #0 on pins 3 (pin A) and 2 (pin B) a.encoderRead(0) % read position a.encoderReset(0) % reset encoder 0 a.encoderStatus; % get status of all three encoders a.encoderDebounce(0,12) % sets debounce delay to 12 (~1.2ms) a.encoderDetach(0); % detach encoder #0

%-- adafruit motor shield (with AFMotor library) a.motorRun(4, 'forward') % run motor forward a.stepperStep(1, 'forward', 'double', 100); % move stepper motor

%-- close session delete(a)

Some slides and examples related to this package can be found here: https://www.mathworks.com/matlabcentral/fileexchange/27843

Finally, more detailed info about use and troubleshooting can be found in the readme.txt file contained in this submission.

인용 양식

Giampiero Campa (2024). Legacy MATLAB and Simulink Support for Arduino (https://github.com/giampy1969/legacy-matlab-and-simulink-support-for-arduino/releases/tag/v1.15.0.0), GitHub. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2010a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Simulink Supported Hardware에 대해 자세히 알아보기
커뮤니티
 Power Electronics Control 커뮤니티에 더 많은 파일이 있습니다

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.15.0.0

See release notes for this release on GitHub: https://github.com/giampy1969/legacy-matlab-and-simulink-support-for-arduino/releases/tag/v1.15.0.0

1.14.0.0

Added spaces to enhance readability
Updated description indicating new options for projects based on R2014a or higher.
Updated name and description.
Removed reference and link to the old webinar.
Added one space in the description.
Trying bigger picture
Uploaded picture

1.13.0.0

Improved handling of mega-related pins from Simulink ADIO blocks. Also added instruction (in the readme.txt file) on how to use the official stepper.h Arduino library with this package.

1.12.0.0

Reorganized sketch handling and examples, improved docs and added support for Adafruit Motor Shield V2.

1.10.0.0

Encoder debouncing function added

1.7.0.0

1) Simulink library now handles pre-existing Arduino objects
2) MEGA board fully supported
3) Servo support greatly improved
4) Full encoder support
5) Example function for customization
6) Assorted minor improvements

1.6.0.0

Minor fixes and improvements, mainly for the MEGA and ChipKIT32 boards.

1.5.0.0

Minor fixes to demo mode for servo handling

1.4.0.0

* Minor changes to readme, Simulink example models, and .pde files
* Added images for Simulink model preview

1.0.0.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.