Filter löschen
Filter löschen

sending slider values from serial port....

1 Ansicht (letzte 30 Tage)
Smith Steven
Smith Steven am 18 Jun. 2013
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??

Akzeptierte Antwort

David Sanchez
David Sanchez am 18 Jun. 2013
% 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 Kommentare
Smith Steven
Smith Steven am 18 Jun. 2013
shouldn't the last line be like: fprint(s1,my_value);
David Sanchez
David Sanchez am 18 Jun. 2013
yes, sorry, it was a typo:
fprintf(s1,my_value)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Licensing on Cloud Platforms finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by