MATLAB Support Package for Arduino (Aka ArduinoIO Package) - File Exchange - MATLAB Central

October 20, 2017 | Author: claytoncage | Category: Arduino, Matlab, Computing, Technology, Computer Engineering
Share Embed Donate


Short Description

Download MATLAB Support Package for Arduino (Aka ArduinoIO Package) - File Exchange - MATLAB Central...

Description

25/09/13

MATLAB Support Package for Arduino (aka ArduinoIO Package) - File Exchange - MATLAB Central Search:

File Exchange Create Account

File Exchange

Answ ers

New sgroup

Link Exchange

Blogs

Trendy

Cody

MATLAB Support Package for Arduino (aka ArduinoIO Package) by MathWorks Classroom Resources Team 28 Jul 2011 (Updated 17 Oct 2012) MATLAB class and Simulink blocks for communicating w ith an Arduino microcontroller board |

Contest

Log In

MathWorks.com

Dow nload Submission

4.3 | 15 ratings

Rate this file 1591 Dow nloads (last 30 days) File Size: 352 KB File ID: #32374

Watch this File

Code covered by the MathWorks Limited License

Highlights from

MATLAB Support Package for Arduino (aka ArduinoIO Package) arduinoCleanup(customData... arduinoCleanup(customData) getSetupBlockUserData(mod...

File Inform ation Description Arduino (w w w .arduino.cc) is a low -cost open-source electronics prototyping platform. MATLAB Support Package for Arduino (also referred to as "ArduinoIO Package") allow s you to communicate w ith an Arduino Uno or Duemilanove over a serial port. It consists of a MATLAB API on the host computer and a server program that runs on the Arduino. Together, they allow you to access Arduino analog I/O, digital I/O, operate servo motors, read encoders, and even handle dc and stepper motors using the adafruit motor shield, all from the MATLAB command line. The Support Package also includes Simulink blocks for communicating w ith the Arduino. For more information about the Support Package, see: http://w w w .mathw orks.com/hardw are-support/arduino-matlab.html For Simulink blocks that support code generation, see: http://w w w .mathw orks.com/hardw are-support/arduino-simulink.html Sample usage: %-- connect to the board a = arduino('COM9')

getSetupBlockUserData(modelHandl e, arduinoVar) msfun_arduino_analogread(... Help for Writing Level-2 M-File SFunctions: msfun_arduino_analogw rite... Help for Writing Level-2 M-File SFunctions: msfun_arduino_dcmotor(block) Help for Writing Level-2 M-File SFunctions: msfun_arduino_digitalread... Help for Writing Level-2 M-File SFunctions: msfun_arduino_digitalw rit... Help for Writing Level-2 M-File SFunctions: msfun_arduino_encoderread...

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

Help for Writing Level-2 M-File SFunctions:

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

Help for Writing Level-2 M-File SFunctions:

%-- analog i/o a.analogRead(5) % read analog pin 5 a.analogWrite(9, 155) % w rite 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

msfun_arduino_encoderrese...

msfun_arduino_io_setup(bl... Help for Writing Level-2 M-File SFunctions: msfun_arduino_servoread(b... Help for Writing Level-2 M-File SFunctions: msfun_arduino_servow rite(... Help for Writing Level-2 M-File SFunctions: msfun_arduino_stepper(block) Help for Writing Level-2 M-File SFunctions: msfun_realtime_pacer(block)

a.servoDetach(9); % detach servo from pin #9

Help for Writing Level-2 M-File SFunctions:

%-- 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

slblocks

%-- adafruit motor shield (w ith AFMotor library) a.motorRun(4, 'forw ard') % run motor forw ard a.stepperStep(1, 'forw ard', 'double', 100); % move stepper motor

example_mot.m

%-- close session delete(a) Acknow ledgem ents Real Time Pacer For Simulink inspired this file. This file inspired I2 C Block For Arduino Io Simulink Package. Required Products MATLAB MATLAB release MATLAB 7.10 (R2010a)

arduino blink_challenge.m contents.m example_io.m

install_arduino.m arduino_io_lib blink_challenge_sf blink_challenge_sim blink_led_sim blinkchallenge encoder_sim library_test motor_sim

Tags for This File Everyone's Tags adafruit(3), adiosrvpde or mororsrvpde, analog, and that the board is connected to the indicated serial port you, arduino(14), data acquisition(5), digital, duemilanove(2), encoder(2), hardw are interface(3), lab hardw are, leonardo(2), measurement, mechatronics, mega(2), motor, motor shield, please make sure that the arduino is

servo_sim stepper_sim

www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package?download=true

1/8

25/09/13

MATLAB Support Package for Arduino (aka ArduinoIO Package) - File Exchange - MATLAB Central leonardo(2), measurement, mechatronics, mega(2), motor, motor shield, please make sure that the arduino is pow ered on, running either srvpde, servo, simulink(3), simulink normal mode io(2), support package(2), test and measurement, the error and w arning occurred w hile onnecting arduino w arning u(2), uno(3)

View all files

Tags I've Applied Add New Tags Please login to tag files.

Please login to add a comment or rating.

Com m ents and Ratings (65) 07 Sep 2013

Thomas

I have successfully installed all IO files, .pde files, and can connect my arduino (plus motor shield) to matlab. How ever, w hen the connection is established, matlab lists off servos 2-69, instead of the 2 associated w ith my motor shield. Additionally, no commands w ill operate my stepper, servos or motors (w hich I have tested in the IDE w orkspace, they w ork fine). Matlab says EDU>> a=arduino('COM3') Attempting connection ............. Motor Shield Script detected ! Arduino successfully connected ! But nothing w orks? Any idea?

28 Jul 2013

Alon

Generally w orks nicely! Please note there is problem w ith MATLAB communication w ith some Mega boards w ith un-updated firmw are. See here: http://w w w .mathw orks.com/matlabcentral/answ ers/40698#answ er_9 2927

10 Jul 2013

Karen Manuel

Hi! I have this project to do but suddenly i encounter this ??? Error using ==> arduino>arduino.arduino at 101 Connection unsuccessful, please make sure that the Arduino is pow ered on, running either srv.pde, adiosrv.pde or mororsrv.pde, and that the board is connected to the indicated serial port. You might also try to unplug and re-plug the USB cable before attempting a reconnection. please help.. thank you.

01 Jul 2013

Bella

Hi, I am trying to run a stepper motor using a seeedstudio motor shield v1.0 paired w ith an arduino uno, and it is totally fine running the stepper in the arduino IDE but I haven't managed to budge it using MATLAB. I have been successful moving servos and reading analog voltages through MATLAB, so maybe the problem is the motor shield? Any help w ould be greatly appreciated!

12 Jun 2013

addie iraw an

Dear Sir/Mdm; I w ould like to ask, how can I expand the number of pins for each block example Digital Write Block to up to 31 pins. As you know Arduino Mega have 31 pins of Digital IO and 16 A/D pins. The block is limited to 15 pins for Digital Write I/O. Please help me on this because I need more pins for my current project. Thank you, A.Iraw an

11 Jun 2013

Christopher

OK, found a video that helps figuring it out. http://w w w .youtube.com/w atch?v=RAkw -lnaZR0

11 Jun 2013

Christopher

Undefined function 'arduino' for input arguments of type 'char'. Can't figure out the problem, even after follow ing Gagan's advices. Please help. Simulink is w orking properly!

28 May 2013

Rodrigo R. Oliveira

Installed in my MAC pro, MATLAB R2012b, and Arduino UNO.

23 May 2013

Omar Perez

When Arduino and Matlab w ork together using the arduino io library. What's the clock speed?

18 May 2013

Dheerendra Rathor

When i start w ith a=arduino('COM5'); it returns a error "??? Undefined function or method 'arduino' for input arguments of type 'char'." i can't figure out w hy. can anybody help me?

12 May 2013

Jiri Vejvoda

12 May 2013

Jiri Vejvoda

06 May 2013

Miguel

it w orks w ell, bot sometimes it doesnt recognize any COM port...... A question: someone have tried to send a value of angle to a servo from a variable? i w ant to send an angle to a servo, but it changes depending some conditions, so i w ant to send something like this target.servoWrite(10,ang);

www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package?download=true

2/8

25/09/13

MATLAB Support Package for Arduino (aka ArduinoIO Package) - File Exchange - MATLAB Central target.servoWrite(10,ang); w here"ang" is variable. I have tried to program this, but matlab says it isnt a valid argument.......some ideas? PD: sorry for bad english

30 Apr 2013

Zhuo Li

24 Apr 2013

Tracy

Hi all, Is there a similar srv.pde file for Aeroquad shields instead of Adafruit shields? Thanks, Tracy

31 Mar 2013

Hadeel

Hello all , I have this problem please help me a= arduino('com32') Java exception occurred: java.lang.NoClassDefFoundError: Could not initialize class gnu.io.CommPortIdentifier at com.mathw orks.toolbox.instrument.SerialComm.findAllPorts(SerialCom m.java:1019) at com.mathw orks.toolbox.instrument.SerialComm.isValidPort(SerialCom m.java:540) at com.mathw orks.toolbox.instrument.SerialComm.openHardw are(Serial Comm.java:373) at com.mathw orks.toolbox.instrument.Instrument.fopen(Instrument.java:1 604) ??? Error using ==> arduino>arduino.arduino at 83 Could not open port: com32 thank you

08 Feb 2013

Petteri T

Thanks a lot for providing this package and I did not seem to have any problems w ith Arduino Uno. How ever I w as just w ondering before getting Leonardo if the Matlab I/O package w ould w ork w ith it as apparently it doesn't behave exactly the same w ay as the older Arduinos do? Namely in regard to the DtrEnable: http://arduino.cc/forum/index.php?topic=140090.0

30 Jan 2013

Dilip Aldar

THe Error and w arning occurred w hile onnecting arduino: Warning: Unsuccessful read: A timeout occurred before the Terminator w as reached. Error using arduino (line 101) Connection unsuccessful, please make sure that the Arduino is pow ered on, running either srv.pde, adiosrv.pde or mororsrv.pde, and that the board is connected to the indicated serial port. You might also try to unplug and re-plug the USB cable before attempting a reconnection.

27 Jan 2013

Kevin

??? Error using ==> arduino>arduino.arduino at 103 Connection unsuccessful, please make sure that the Arduino is pow ered on, running either srv.pde, adiosrv.pde or mororsrv.pde, and that the board is connected to the indicated serial port. You might also try to unplug and re-plug the USB cable before attempting a reconnection. Error in ==> ard at 1 a=arduino('com7') Now I have this error, tried changing the adiosrv code but doesn't help, any help w ould be appreciated

25 Jan 2013

Kevin

??? Error using ==> arduino Error: File: arduino.m Line: 1 Column: 10 A class definition must be in an "@" directory. I have this error on my matlab w hich is MATLAB R2010b w hen i run a=arduino('COM7') please help

08 Jan 2013

Gagan

Hi YXING, here are the solution: 1.In matlab use[ tic w hile(pingpin~=1) toc] this w ill give u the elapsed time till pingpin goes high. 2.Use SD card shield to record the data and plot it if u don't need to plot it realtime. if u require real time plot then go for 1. 3.This method is the alternative of 2 w ithout using sd card shield and is 'JUGAD' method. serial print the distance data in the monitor.once u r done copy paste it as a variable in matlab and do synthesis or analysis w hatever u w ant. HOpe this w ill prove helpful for you

07 Jan 2013

YXING

I am using a ultrasonic distance sensor in my project and it seems that

www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package?download=true

3/8

25/09/13

MATLAB Support Package for Arduino (aka ArduinoIO Package) - File Exchange - MATLAB Central

07 Jan 2013

YXING

I am using a ultrasonic distance sensor in my project and it seems that the ArduinoIO Package doesn't support it. Reading the sensor requires the "pulsein" function, w hich seems not available in the Matlab environment. Any possible solution? P.S. I need to control DC motors (using PWM) according to the distance read from the sensors. At the same time, the distance data needs to be taken dow n, analyzed and used to draw graph so Matlab seems essential.

14 Dec 2012

Ejri

I am w orking on a project to run 2 stepper motors simultaneously using Matlab. I w as able to run the 2 motors in Matlab using an Uno and a motorshield (after uploading the srv.pde. The srv.pde is required for the shield to w ork in my case.), but I w asn't able to run the motors simultaneously. I tried I2C w ith an another Uno and using the Wire library (http://arduino.cc/en/Tutorial/MasterWriter) in addition to the AccelStepper library, I w as able to run the motors simultaneously using the Arduino 1.0.2 softw are. Is there a w ay of adding the Wire and AccelStepper libraries to the srv.pde so that I can use I2C and AccelStepper in Matlab? Is there another w ay of running 2 motors simultaneously using Matlab? Thank you

25 Nov 2012

Angus

21 Nov 2012

Merlin Mifsud

Dear all, I had some mistakes regarding previous comment. I w ant to interface an adis16480 IMU sensor w ith matlab, how ever this is not possible using the ug-287 evaluation board. 1)Now I am w ondering if it is possible to read spi ports using arduino and read from arduino using matlab in real time? 2)And how possible it is to w rite and read from Maltab to the Spi Ports of the ADIS16480 (through arduino)? 3)Should I use arduino uno, Duemilanove or MEGA 2560 for simplest communications betw een ADIS16480 spi ports and matlab? many thanks :)

21 Nov 2012

Merlin Mifsud

Dear all, I w ant to interface an adis16480 IMU sensor w ith matlab, how ever this is not possible using the ug-287 evaluation board. 1)Now I am w ondering if it is possible to read serial ports using arduino and read from arduino using matlab in real time? 2)And how possible it is to w rite and read from Maltab to the Serial Ports of the ADIS16480 (through arduino)? 3)Should I use arduino uno, Duemilanove or MEGA 2560 for simplest communications betw een ADIS16480 serial ports and matlab? many thanks :)

11 Nov 2012

Rodolfo Buschle

Hello all, I'm running Arduino IO w ith an Arduino MEGA 2560. I need 16 analog ports, how ever I can only access ports 0 to 5... Anyone know s how to solve this issue? This is the error message I get: "Error using arduino/analogRead (line 499) Unallow ed value for analog input pin number, the value must be an integer going from 0 to 5"

10 Nov 2012

Gagan

HI ZHU There might be three things gone w rong w ith you 1.Check the right COM port in device manager 2.Define a variable for your arduino...like a=arduino('COM3') 3.The IDE must be closed or disconnected so that MATLAB can use the serial connection. Hope this w ill be beneficial for you...GUD LUCK and enjoy support package its really good stuff.

10 Nov 2012

Gagan

HI ZHU There might be three things gone w rong w ith you 1.Check the right COM port in device manager 2.Define a variable for your arduino...like a=arduino('COM3') 3.The IDE must be closed or disconnected so that MATLAB can use the serial connection. Hope this w ill be beneficial for you...GUD LUCK and enjoy support package its really good stuff.

09 Nov 2012

zhu

I installed the arduino on w indow s xp. And I follow ed the steps to install the arduino package in Matlab. "install_arduino" w orks fine. "arduino('COM3')" alw ays fail. It said that "Undefined function or variable 'private'. "

www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package?download=true

4/8

25/09/13

MATLAB Support Package for Arduino (aka ArduinoIO Package) - File Exchange - MATLAB Central Andy body know w hat's w rong w ith it? Thank you so much!

25 Oct 2012

Alan Chen

Very very useful for the arduino's increasing capabilities!

17 Oct 2012

fabius

very usefull for arduino increasing capabilities. The only limit of this project is a better serial communication (still too many errors serial port controls)

14 Sep 2012

Chien-Hung Lin

When I use a=arduino('COM6') to connect arduino by matlab2010a, but error. What problem is it? The board is OK? >> a=arduino('COM6') Attempting connection ............. Warning: A timeout occurred before the Terminator w as reached. ??? Error using ==> arduino>arduino.arduino at 101 Connection unsuccessful, please make sure that the Arduino is pow ered on, running either srv.pde, adiosrv.pde or mororsrv.pde, and that the board is connected to the indicated serial port. You might also try to unplug and re-plug the USB cable before attempting a reconnection.

05 Sep 2012

Suhaib

05 Sep 2012

Suhaib

hi,thank you for this update. but i cant see any change of "digital w rite and read .... analog w rite and read " in the simulink library ..it supports the same pins as previous versions. thank you ^^

19 Aug 2012

Manko

Hi. I just recently started to play w ith the Arduino Uno. I have a problem w here w henever I try to close the session, I get a "segmentation violation detected" error. Does anyone have any insights to this problem? I am using MBP lion and Matlab 7.8.0 I tried delete(a) and delete(instrfind({'port'},{/dev/tty.usbmodem1d11'})) but both gave the same error message

18 Aug 2012

Prem

Everything w orks for me. There are limitations but it is cool.

26 Jul 2012

Sanchitha w ijayaw ardhana

Hello I successfully used this support package.My problem is,how to use this support package for another code in another path.When i used this package for another code,it gives the follow ing error ??? Error using ==> install_arduino at 15 There is at least another arduino.m file in the path, please delete any other versions before installing this one Do i have to delete all the support package .m files in the existing path to w ork w ith a new code in a different path???

16 Jun 2012

fabius

I had a problem timeout and error communication. I use Arduino duemilanove (ATMEGA 168) I fixed this issue by changing ADIORSV:PDE on line 40, w here there is a cicle for 20 PINS (insetad of 13 of Arduino Duemilanove). i posted better explanation on my ow n question about, Here: http://w w w .mathw orks.com/matlabcentral/answ ers/40698-errortimeout-communication-matlab-arduino-in-support-package-forarduino-aka-arduinoio-package

07 Jun 2012

Hernan

Hello, I w as w ondering if the arduino io w ould w ork w ith the liquid crystal library for the Arduino? I am trying to display a message from matlab on an LCD using the arduino.

25 May 2012

Jean-Marc ALLENBACH

I successfully used Arduino I/O w ith MATLAB R2009b. Only some Port COM problems due to XP platform: return to default port number after a deconnexion of Arduino board.

25 May 2012

Jean-Marc ALLENBACH

I successfuly used Arduino w ith R2011a I tried the same in the classroom w ith R2007b No problem w ith install_arduino, but w ith arduino('COM5') I received an error message: ??? Error: File: arduino.m Line: 6 Column: 35 Undefined function or variable 'private'. Error in ==> StartArd at 10 a=arduino('COM5') Is it possible to solve the problem on this version R2007b of Matlab or have I to take time to install R2012a on all classrooms?

17 Apr 2012

Muhammad Adeel khan

hello i am trying to control the motion of a motor by using simulink blocks(of arduino matlab support package).i need an encoder(position) input as feed back in my control model. can any one help me how can i read encoder value in my control model?

10 Apr 2012

Nancy

Can I control a servo motor from Matlab w ithout using a motor shield I tried to use this code:

www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package?download=true

5/8

25/09/13

MATLAB Support Package for Arduino (aka ArduinoIO Package) - File Exchange - MATLAB Central I tried to use this code:

a=arduino('COM3'); a.pinMode(10, 'OUTPUT'); a.analogWrite(10, x); % w here x= from 0 up to 255 but it did not w ork can anyone help me?? 05 Apr 2012

Gautam Vallabha

Abhineet, please post your question at http://w w w .mathw orks.com/matlabcentral/answ ers, as noted above. I w ill be happy to answ er it there.

04 Apr 2012

Abhineet Mishra

Hello First of all I must thank you for providing us w ith such a nice interface betw een MATLAB and Arduino. Actually I w as w ondering if you have any function like Arduino's 'MAP' function w hich can actually map analoginput data into a specific range. Thanks in Advance

03 Apr 2012

MathWorks Classroom Resources Team

General guidelines * Please use this FileExchange page for general comments and ratings on the support package * If you have questions about using this support package, post your question at http://w w w .mathw orks.com/matlabcentral/answ ers (w ith tag "arduino", and product "matlab")

03 Apr 2012

Gautam Vallabha

Jose: The readme.txt file included w ith the support package has instructions for how to modify the code to w ork w ith Arduino Mega (search for "ARDUINO MEGA" in the readme.txt).

03 Apr 2012

José Antonio Segura

Hello. I'm actually using and Arduino Mega 2560 and API_Matlab. But I have a problem, I cant's access to all PWM outputs, because the library just recognize as PWM the digital pins 3 5 7 9 10 and 11, that are the PWM pins of Arduino Uno Board. Did you know how can I access to all PWM pins of Arduino Mega 2560?

25 Mar 2012

Andrey Zagvazdin

Hello! I MatLAB 7.12 (R2011a) 64-bit. OS Window s 7 Fee clone Arduino, Russian assembly Freeduino (http://freeduino.ru/arduino/index.html), a complete analog Ardruino Uno / Duemilanove w /ATmega328. My actions: 1 - Connection "Arduino" to MatLAB * Set ArduinoIO (http://w w w .mathw orks.com/matlabcentral/fileexchange/32374); * Unpack the package into C: \ arduinoIO; * >> Cd c: \ arduinoIO * >> Install_arduino * >> Savepath * Flashed "Arduino" core srv.pde (https://github.com/adafruit/AdafruitMotor-Shield-library/zipball/master); * >> A = arduino ('COM4'); At this point, everything is OK! From the w indow MatLAB, board responds and takes command. 2 - Connection "Arduino" to SIMULINK * Dow nloading the package Simulink Support Package for Arduino (http://w w w .mathw orks.com/matlabcentral/fileexchange/30277); * "Simulink Support Package for Arduino" unpacked to C: \ arduino_simulink * Dow nloading Wednesday Arduino IDE (arduino-1.0) and extract it to c: \ ArduinoTarget * >> Cd c: \ arduino_simulink * >> Addpath (fullfile (pw d, 'arduino'), fullfile (pw d, 'blocks'), fullfile (pw d, 'demos')) * >> Savepath * >> Sl_refresh_customizations * Plug-in board "Arduino" to your computer. * Indicates the path to the environment Arduino IDE >> arduino.Prefs.setArduinoPath ('c: \ ArduinoTarget') That's all up to this point NORMALLY PUT. * Determine the current platform team >> Arduino.Prefs.setBoard ('atmega328') or >> arduino.Prefs.setMcu ('atmega328') Throw s an error >> Arduino.Prefs.setBoard ('atmega328') ?? Reference to non-existent element of a cell array. Error in ==> Prefs> Prefs.parseBoardsFile at 227 lhs = parsedLines {i} {1} {1}% can be of the form xx.yy.zz Error in ==> Prefs> Prefs.setBoard at 66 boards = arduino.Prefs.parseBoardsFile (boardsFile); >> Arduino.Prefs.setMcu ('atmega328') ?? Error using ==> Prefs> Prefs.setMcu at 129 This function is deprecated. Use

www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package?download=true

6/8

25/09/13

MATLAB Support Package for Arduino (aka ArduinoIO Package) - File Exchange - MATLAB Central This function is deprecated. Use arduino.Prefs.setBoard instead, e.g. arduino.Prefs.setBoard ('uno')

TRIED TO IGNORE THIS OPTION AND KEEP SETTING, BUT IN MODELING, DEMANDS categorically specify the model. 22 Mar 2012

MathWorks Classroom Resources Team

Alex, thanks for the feedback, i'll think about it.

20 Mar 2012

Abdullah

w hy ı can connect servo just pin 9 and 10. I have 4 more pw m pin.. ? anyone can edit the files and blocks to add 6 servos to the arduino.

23 Feb 2012

alexander

using a.stepperStep() has a maximum number of steps of 255 and causes unexpexted results w ith for loops. How can i avoid this and get the number of steps i w ant.

10 Jan 2012

Giampiero Campa

UPDATE: in the new version (3.2) the problem due to the fact that INTERNAL is not declared for the MEGA has been solved (basically now there is a macro that defines INTERNAL as equal to INTERNAL1V1 w hen compiling for the MEGA).

Abdullah, it's because the servo methods w ere made to support the adafruit motor shield, w hich only supports servo connected to pins 9 and 10. I w ill remove this limitation sometime this summer. How ever if you look at the code it should not be too hard to modify it to extend it to 6 servos.

Please consider dow nloading the last version if you often sw itch betw een the UNO and MEGA boards. 09 Jan 2012

Gautam Vallabha

Sun, the MATLAB Support Package does not support code generation. The included Simulink blocks communicate w ith the Arduino in Simulink "normal" (aka. simulation) mode only. For blocks that support code generation, see http://w w w .mathw orks.com/academia/arduino-softw are/arduinosimulink.html

08 Jan 2012

Sun

Hello When I try to call block analogread, everytime I build w ill pop: The corresponding 'msfun_arduino_analogread.tlc' file for the MATLAB S-function 'msfun_arduino_analogread' in block 'test1/Arduino Analog Read' must be located in the current w orking directory, the MATLAB S-function directory 'C:\Users\Julio\Documents\MATLAB\ArduinoIO\simulink', or the directory 'C:\Users\Julio\Documents\MATLAB\ArduinoIO\simulink\tlc_c' and I ingnore it matlab just quit. Even the demo cannot w ork. Anyone has ideas? Julio

20 Dec 2011

Alonso

For the INTERNAL problem w ith the mega2560 I found this: http://arduino.cc/en/Reference/AnalogReference INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328 and 2.56 volts on the ATmega8 (not available on the Arduino Mega) INTERNAL1V1: a built-in 1.1V reference (Arduino Mega only) INTERNAL2V56: a built-in 2.56V reference (Arduino Mega only) So just replace "INTERNAL" w ith "INTERNAL1V1" and it should w ork.

09 Dec 2011

Sotiris

Hello everyone, I am trying to Upload,"adiosrv.pde" on the arduino mega2560 but I get the follow ing message: "adiosrv.cpp: In function 'void loop()': adiosrv:239: error: 'INTERNAL' w as not declared in this scope" Any suggestions?? Thank you in advance

07 Dec 2011

Michael

This is a total hack, but for those of you w ho are getting 'Connection unsuccessful' error and are sure that the serial port is w orking fine (i.e. by checking it w ith a program like TeraTerm and typing in '99') then you can set chk to be 1 (or 2 or 3), depending on w hich pde you had uploaded into the Arduino. % query script type fw rite(a.aser,[57 57],'uchar'); chk=fscanf(a.aser,'%d'); chk = 1; % SHOULDN'T HAVE TO DO THIS!

06 Dec 2011

JULIO DE LUNA

I had the same problem, all w e did w as add a / * in / * Case 49: analogReference (INTERNAL); break; then, I had no problems =)

05 Dec 2011

Fardin

I am having problem w ith loading the srv.pde file to Arduino Mega 2560. When compiling, the error is on line 553: analogReference(INTERNAL); and the error message is: srv.cpp: In function 'void loop()': srv:552: error: 'INTERNAL' w as not declared in this scope

www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package?download=true

7/8

25/09/13

MATLAB Support Package for Arduino (aka ArduinoIO Package) - File Exchange - MATLAB Central srv:552: error: 'INTERNAL' w as not declared in this scope I have done all the steps before this step. Please Help. And thanks in advance.

07 Nov 2011

Roman

I have installed all packages for Arduino support. In Matlab command line can successfully connect to Arduino and operate all its pins. I w ant to use function msfun_arduino_analogread(block), link: http://w w w .mathw orks.com/matlabcentral/fileexchange/32374matlab-support-package-for-arduino-aka-arduinoiopackage/content/simulink/msfun_arduino_analogread.m But w hen add in Simulink block "Level-2 MATLAB S-Function" I have the follow ing error (screen shot): http://habrastorage.org/storage1/fdff41a7/f8668eac/77eb249a/38eb6 7f6.png Can I go another w ay to read data from Arduino in Simulink? I just w ant to use my Arduino as Analog Input in Simulink.

30 Oct 2011

Tony Stark

Your problem seems like the one I ran into as w ell. What I did w as double check my COM port in device manager. Opened up matlab and clicked in the "Current Folder" pane, navigated to w here I unzipped the "ArduinoIO" package, right clicked the folder and added it and its subdirectories othe path, then execute the "savepath" command. If that doesnt w ork, force your COM port to be COM8 or COM5. Also run matlab as admin (SHIFT + Right Click "Run as Adminstrator")

26 Oct 2011

Ernesto

I've been follow ing the steps on the Readme file. I already added the arduino folders path successfully. Now I'm trying to run the a=arduino('port') in my case COM4 and I get the error: ??? Error: File: xx/xx/xx Line: 6 Column: 26 The expression to the left of the equals sign is not a valid target for an assignment. Does anyone know w hat might be going w rong? I already also tried a=arduino('/dev/ttyUSB0') instead of COM4 but I got the same error.

09 Oct 2011

Cameron

Updates 18 Aug 2011

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

26 Oct 2011

Minor fixes to demo mode for servo handling

24 Dec 2011

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

04 Sep 2012

1) 2) 3) 4) 5) 6)

17 Oct 2012

Encoder debouncing function added

Simulink library now handles pre-existing Arduino objects MEGA board fully supported Servo support greatly improved Full encoder support Example function for customization Assorted minor improvements

Contact us

© 1994-2013 The MathWorks, Inc.

Site Help Featured MathWorks.com Topics:

Patents

Trademarks

Privacy Policy

New Products

Support

Documentation

Preventing Piracy Training

Terms of Use

Webinars

Newsletters

www.mathworks.com/matlabcentral/fileexchange/32374-matlab-support-package-for-arduino-aka-arduinoio-package?download=true

MATLAB Trials

Careers

8/8

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF