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.
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:
2. Double click on Static Text to change its properties:
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:
6.Under function FIRE type:
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: