In this project Arduino Uno uses the Ultra Sonic Sensor to sense the obstacle distance and then sends this distance to PC whenever MATLAB Application request for it.
Arduino UNO Code is written in Arduino IDE.
PC Application is written in MATLAB.Working
Arduino Calculates the Obstacle Distance, and whenever MATLAB PC Application Request, Ardiuno Uno board sends the data to MATLAB, which will be displayed on the MATLAB GUI, apart from this MATLAB also send packet to change the on board led state, to which Arduino change its state and reply back with the current led state and this is also updated on MATLAB GUI.
Full Source Code Download link is attached.
YouTube video of the running setup is also attached or you can see it from here also https://www.youtube.com/watch?v=_EdyW0971fY
The data sharing between the MATLAB and Arduino is done using a packet whose format is as follow:
Header, Destination Address, Source Address, Length, Op_Code, Data (n Bytes), CRC16 (Optional), Checksum
The PC application is created in such a way, that it is easier to add other functionality with this GUI as base code, that's why sharing this.
But still there are lots of improvements which i will do, will also develop some other examples and share on the same page.