I want to communicate with an Arduino board using Matlab through a serial port. The Arduino board will transmit 8 bytes of BINARY data every 20 ms once it receives a 1. The transmission will stop if the Arduino receives a 0.
The following commands in an m-file work as expected when I step through them in the debug mode. However, the transmission stopped immediately when I ran the m-file. The s.BytesAvailable is zero. It looks like the pause command has not properly executed. Why was wrong? How can I fix it? Thanks.
s = serial('COM15','BaudRate',115200);