フィルターのクリア

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 Center および File ExchangeString Parsing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by