In this project, we will control the status of an LED by creating a MATLAB GUI having two push buttons. One push button turns LED on and the other push-button turns it off.
Welcome to the second tutorial or tutorial no. 1.1 of the course “using MATLAB GUI with Arduino support package”. Click here to read tutorial no. 1.0, ‘Installing Arduino support package & Matlab GUI basics’ or very first tutorial of the course.
Watch this quick but detailed video to create your first “MATLAB GUI – Arduino” project.
1. First of all create this GUI in Blank GUI and then run it.
For pushbutton on left side: String name = ‘ON’ ; Tag name = ‘ON’
For pushbutton on left side: String name = ‘OFF’ ; Tag name = ‘OFF’
2. Now under Opening function type these commands:
clear all;
global a;
a= arduino(‘COM3’);
3. Under function ‘ON’ type:
global a;
writeDigitalPin(a,6,1)
3. Under function ‘OFF’ type:
global a;
writeDigitalPin(a,6,1)
NOTE: This code is explained in detail in the above video ^.
SETUP:
NOTE: Watch the above video to see this GUI in action!
