L'interfaçage Arduino avec MATLAB – Clignotement de la LED

In this project, we are going to learn,

  1. How to set up hardware support for Arduino in MATLAB software.
  2. How to control an Arduino using MATLAB code.

We normally use Arduino IDE to write and upload codes to Arduino. The advantage of MATLAB is, it uses a high-level programming language which is easier than C / C++. The other advantage of using MATLAB is, we can see the results of I/O operations quickly (without compiling). Moreover, MATLAB provides plotting functions that we can use to quickly analyze and visualize data collected from Arduino. First, we are going to learn how to setup hardware support package for Arduino in MATLAB software. After setting up hardware support package for Arduino in MATLAB software, we are going to control LEDs that are connected to Arduino board using MATLAB code.

Interfacing Arduino with MATLAB - Blinking LED

Setup Hardware Support Package for MATLAB:

Step 1. Start MATLAB (latest Version preferred).

Step 2. In the Environment section, select Add-Ons > Get Hardware Support Packages.

Step 3. It will start the Add-On explorer window.

Step 4. Click on MATLAB Support Package for Arduino Hardware.

Step 5.  Click on Install, now the installer will ask you to log into your MathWorks account. If you don’t have MathWorks account, you can create an account during installation.

Step 6.  After logging in, Accept the license agreement and proceed to installation.

Step 7.  Now, wait for the package to download and install.

Step 8.  Now you have successfully installed Arduino Support Package for MATLAB.

Testing MATLAB:

After installing the support package for MATLAB, we need to check whether it is installed properly or not.

1. Open MATLAB.

2. Connect Arduino to PC.

3. Type the following command in MATLAB command window.

a = arduino()

4. If we have more than one Arduino connected to PC, then we can specify the board type and COM  port to which it is connected using the following command.

Interfacing Arduino with MATLAB - Blinking LED schematics

a = arduino( ‘COM5’ , ‘uno’ )

5. After entering the above command, MATLAB will try to communicate with your Arduino, if successful, MATLAB will display the properties of Arduino board connected to PC.

Read more: Interfacing Arduino with MATLAB – Blinking LED


A Propos De L'Auteur

Ibrar Ayyub

Je suis expérimenté, rédacteur technique, titulaire d'une Maîtrise en informatique de BZU Multan, Pakistan à l'Université. Avec un arrière-plan couvrant diverses industries, notamment en matière de domotique et de l'ingénierie, j'ai perfectionné mes compétences dans la rédaction claire et concise du contenu. Compétent en tirant parti de l'infographie et des diagrammes, je m'efforce de simplifier des concepts complexes pour les lecteurs. Ma force réside dans une recherche approfondie et de présenter l'information de façon structurée et logique format.

Suivez-Nous:
LinkedinTwitter

Laisser un Commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

fr_FRFrench
Faire défiler vers le Haut