1.4 Potentiometer’s analog input to control brightness of LED using Arduino and Matlab GUI

In this project, we will create a Matlab GUI with one pushbutton. This pushbutton when pressed, prints analog input from potentiometer on Matlab command window and at the same time gives this voltage value across LED.


1.5.1: Creating GUI :”Interfacing L298N with Arduino using MATLAB GUI” (PART 2)

1.5.0 PROJECT OVERVIEW: Interfacing L298N motor driver with Arduino using Matlab GUI

1.4 Potentiometer’s analog input to control brightness of LED using Arduino and Matlab GUI

1.3 Print Analog input from a potentiometer on Matlab Command Window using Arduino

1.2 Controlling brightness of LED using Matlab GUI and Arduino in 2017

1.1 Controlling status of LED from MATLAB GUI and Arduino in 2017

1.0 Installing Arduino support package & Matlab GUI basics in 2017

Welcome to the fifth tutorial or tutorial no. 1.4 of the course “using MATLAB GUI with Arduino support package”.Click here TUTORIAL 1.3  to read previous tutorial.

Watch video version of this project for better understanding:

1. First of all create this GUI in Blank GUI and then run it.(How to create GUI on Matlab)






















2. Double click on Static Text to change its properties:




FontSize= “12”;

ForegroundColor= “Orange”;

String= “readthenwrite”

Tag= “readthenwrite”

















3. Double click on PushButton to change its properties:





FontSize = “16”;

ForegroundColor = “GREEN”;

String = “FIRE”

Tag = “FIRE”
















4. Click on Run,  GUI looks like this:























5.Now under Opening function type these commands:


clear all;

global a;

a= arduino(‘COM3’);














6.Under function FIRE type:

global a;





NOTE: Codes are explained in detail in the above video ^.












#Potentiometer’s end terminals to 5V and Gnd pin of Arduino respectively.

whereas wiper terminal to analog pin A0.

#LED’s positive terminal to digital pin 10 and then in series with resistor to Gnd.












8. Click on Run:

 Rotate potentiometer and hit fire:

 Brightness of LED changes in accordance with values printed on Command Window for different positions of wiper terminal:








No Comments

Leave a Reply

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

%d bloggers like this: