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:
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;
x=readVoltage(a,0);
disp(x);
NOTE: Codes are explained in detail in the above video ^.
7.SETUP:
#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:
Hi
I am using Arduino UNO and i am required to make a sweep sine wave for voltage with variable frequency
Could you pls suggest how this can be done and help with the code
Thanking you