run DC motor with Matlab GUI and Arduino

4 次查看(过去 30 天)
Hi, I want to run a DC motor and L298N motor driver with Matlab GUI and Arduino. I use a 5 radio button and one push button. # radio button in one panel which are low speed, medium speed and high speed. While another two is clockwise(CCW) and anticlockwise(ACW). I also have a timer which sends how long the motor will rotate. I already try to code, no error but my motor does not rotate. Attached is my GUI and code.

回答(1 个)

cesar quirino
cesar quirino 2018-5-23
% --- Outputs from this function are returned to the command line. function varargout = TABLEROMANDO_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure varargout{1} = handles.output; clear all, global a; a=arduino('COM3'); a.pinMode(6,'output');
% --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) global a; a.analogWrite(6,20); pause(0.5);

社区

更多回答在  Power Electronics Control

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by