Programming Arduino with Matlab

Arduino matlab - steinacoz

With an Arduino board comes endless possibilities, no wonder I am not surprised stumbling on Matlab romancing with Arduino platform. I decided to check out what this romance is all about.


See also:

To complete this task, you will need these materials:

  • An Arduino board ( I am making use of Arduino mega2560, Arduino clones may not work)
  • A PC with Matlab installed (I am using R2015a version)
  • ¬†LED
  • cables



  • Open your Matlab Software and click on Add-Ons
matlab1 arduino - steinacoz
matlab1 arduino – steinacoz
  • From the drop-down menu, choose Get Hardware Support Packages¬†
  • From the resulting window, you can choose any of the options that suits you
matlab2 arduino - steinacoz
matlab2 arduino – steinacoz
  • Check the first option for now
matlab3 arduino - steinacoz
matlab3 arduino – steinacoz
  • Open your command window and run this command
a = arduino()
  • or this
a = arduino('com4', 'Mega2560')

If you are getting this output, that means everything was successful. You can try switching an LED ON and OFF from Matlab command console:

matlab4 arduino - steinacoz
matlab4 arduino – steinacoz


% turn LED ON
writeDigitalPin(a, 'D13', 1); 

% turn LED OFF
writeDigitalPin(a, 'D13', 0);

You can follow this blog and our social media channels for more tutorials like these.

Leave a Reply

Your email address will not be published. Required fields are marked *