Pages: 1 [2]   Go Down
Author Topic: Arduino to MATLAB  (Read 5827 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I know it's been a while since the last post on this topic, but I did find a solution which actually did work! Lowell Toms posted a great example on the Matlab File Exchange including two examples both the Arduino sketch and Matlab script. Ran on Mac OSX 1.5.8 with R2010a, and Arduino 0018.

Hope that helps!

http://www.mathworks.com/matlabcentral/fileexchange/26711-interacting-with-an-arduino-using-the-matlab-serial-commands
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

UPDATE: There are now 2 standard ways to interact with the Arduino From MATLAB and Simulink:

MATLAB Interface for Arduino
You can download the code for free here :
http://www.mathworks.com/academia/arduino-software/arduino-matlab.html

This lets you control your Arduino board over USB from a MATLAB session, in either Windows, Mac or Linux. For example you can instantiate an Arduino object from MATLAB using:

>> a=arduino('COM5');

and then do stuff like:

>> av=a.analogRead(5);

>> a.pinMode(13,'output');
>> a.digitalWrite(13,1);

>> delete(a)

or if you have a ladyada motor shield:

>> a.servoAttach(1);
>> a.servoWrite(1,45);

>> a.motorSpeed(4,200)      
>> a.motorRun(4,'forward');    

>> a.stepperSpeed(1,10)      
>> a.stepperStep(1,'forward','double',100);

You can also download these slides:
http://www.mathworks.com/matlabcentral/fileexchange/27843
or look at this video to learn more:
http://www.mathworks.com/company/events/webinars/wbnr43537.html

Arduino Target for Simulink
This lets you use Simulink to create programs that run directly on the Arduino board. You can download the code for free here :
http://www.mathworks.com/academia/arduino-software/arduino-simulink.html

The target (available for Windows only) allows a Simulink model (and possibly also Embedded Matlab Code) to be automatically converted to C/C++ code, compiled and downloaded to the Arduino. This is especially useful for control application that need to run at high sampling rate, and in cases where you don't want the Arduino to be connected to a host computer.
Logged

Pages: 1 [2]   Go Up
Jump to: