필터 지우기
필터 지우기

sending slider values from serial port....

조회 수: 1 (최근 30일)
Smith Steven
Smith Steven 2013년 6월 18일
I have a slider in GUI ranging from value 1-100. What i want is whatever value i select, i shall be able to send it to the terminal using Serial port communication... Any ideas??

채택된 답변

David Sanchez
David Sanchez 2013년 6월 18일
% To construct a serial port object:
s1 = serial('COM1');
s2 = serial('COM2', 'BaudRate', 1200);
% To connect the serial port object to the serial port:
fopen(s1)
fopen(s2)
my_value = get(handles.my_Slider_handle,'value');
fprintf(s1,value)
  댓글 수: 2
Smith Steven
Smith Steven 2013년 6월 18일
shouldn't the last line be like: fprint(s1,my_value);
David Sanchez
David Sanchez 2013년 6월 18일
yes, sorry, it was a typo:
fprintf(s1,my_value)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by