Help with the COM1

1 view (last 30 days)
Thierry
Thierry on 20 Apr 2012
Hello,
I'm a french guy and for my project I must to detect movements in a video with matlab and send a signal by the USB port which will trigger an alarm device.
Can you help me beacause I don't know how to send a signal (e.g 00110101001) from matlab to the USB port !!
Have you got a piece of programme to configure the COM ?
Thanks a lot for your answer
Thierry - ESME SUDRIA (ENGINEER SCHOOL, PARIS)

Answers (1)

Walter Roberson
Walter Roberson on 20 Apr 2012
serial() to create the device object. set() to add additional properties (if needed.) fopen() to open the port. fread() and fwrite() to read and write the port.
Signals cannot be sent through serial ports. Serial ports can only send bytes, and bytes for serial ports must be 7 bits, 8 bits, 9 bits, or 10 bits (some hardware might not support anything other than 8 bits, and not many programs know about working with 9 bits or 10 bits.)
Hint:
fwrite(s, bin2dec('00110101'))

Community Treasure Hunt

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

Start Hunting!