function varargout = guix(varargin)
% GUIX MATLAB code for guix.fig
% GUIX, by itself, creates a new GUIX or raises the existing
% singleton*.
%
% H = GUIX returns the handle to a new GUIX or the handle to
% the existing singleton*.
%
% GUIX('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUIX.M with the given input arguments.
%
% GUIX('Property','Value',...) creates a new GUIX or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before guix_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to guix_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help guix
% Last Modified by GUIDE v2.5 04-Sep-2020 12:10:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @guix_OpeningFcn, ...
'gui_OutputFcn', @guix_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before guix is made visible.
function guix_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to guix (see VARARGIN)
% Choose default command line output for guix
handles.output = hObject;
clc;
delete(instrfindall);
global a;
a=serial('COM3');
set(a,'BaudRate',9600,'DataBits', 8, 'Parity', 'none','StopBits', 1, 'FlowControl', 'none','Terminator','CR','Timeout',10);
set(handles.slider4,'value',0.5);
set(handles.slider3,'value',0.5);
set(handles.slider2,'value',0.5);
set(handles.slider1,'value',0);
set(handles.slider5,'value',0.5);
set(handles.slider6,'value',0.5);
set(handles.edit1,'String',0);
set(handles.edit2,'String',90);
set(handles.edit3,'String',90);
set(handles.edit4,'String',90);
set(handles.edit5,'String',90);
set(handles.edit6,'String',90);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes guix wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = guix_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;
% --- Executes on button press in auto.
function auto_Callback(hObject, eventdata, handles)
% hObject handle to auto (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global a;
fopen(a);
pause(2);
z1=0;
x1=num2str(z1);
n1='a';
m1=[n1,x1];
fprintf(a,m1);
fclose(a);
% --- Executes on button press in restar.
function restar_Callback(hObject, eventdata, handles)
% hObject handle to restar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
%global a;
global a;
fopen(a);
pause(2);
z1=0;
x1=num2str(z1);
n1='f';
m1=[n1,x1];
fprintf(a,m1);
fclose(a);
set(handles.edit1,'String',0);
set(handles.edit2,'String',90);
set(handles.edit3,'String',90);
set(handles.edit4,'String',90);
set(handles.edit5,'String',90);
set(handles.edit6,'String',90);
set(handles.slider4,'value',0.5);
set(handles.slider3,'value',0.5);
set(handles.slider2,'value',0.5);
set(handles.slider1,'value',0);
set(handles.slider5,'value',0.5);
set(handles.slider6,'value',0.5);
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
global a;
fopen(a);
pause(2);
valuee1=get(hObject,'value');
y1=valuee1*180;
set(handles.edit1,'String',y1);
round(y1);
x1=num2str(y1);
n1='z';
m1=[n1,x1];
fprintf(a,m1);
fclose(a);
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on slider movement.
function slider2_Callback(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
global a;
fopen(a);
pause(2);
valuee1=get(hObject,'value');
y1=valuee1*180;
set(handles.edit2,'String',y1);
round(y1);
x1=num2str(y1);
n1='x';
m1=[n1,x1];
fprintf(a,m1);
fclose(a);
% --- Executes during object creation, after setting all properties.
function slider2_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on slider movement.
function slider3_Callback(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
global a;
fopen(a);
pause(2);
valuee1=get(hObject,'value');
y1=valuee1*180;
set(handles.edit3,'String',y1);
round(y1);
x1=num2str(y1);
n1='c';
m1=[n1,x1];
fprintf(a,m1);
fclose(a);
% --- Executes during object creation, after setting all properties.
function slider3_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on slider movement.
function slider4_Callback(hObject, eventdata, handles)
% hObject handle to slider4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min')
基于matlab串口通讯的机械臂控制程序
需积分: 43 150 浏览量
2021-03-11
10:27:48
上传
评论 5
收藏 161KB ZIP 举报
mbjxking
- 粉丝: 26
- 资源: 10
最新资源
- Screenshot_20240427_031602.jpg
- 网页PDF_2024年04月26日 23-46-14_QQ浏览器网页保存_QQ浏览器转格式(6).docx
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
- 课设-内部排序算法比较 包括冒泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、归并排序和堆排序.zip
- Python排序算法.zip
- C语言实现直接插入排序、希尔排序、选择排序、冒泡排序、堆排序、快速排序、归并排序、计数排序,并带图详解.zip
- 常用工具集参考用于图像等数据处理
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0