listedunlisted
Newbie level 1
Ok. Here's my problem.
I accomplished the task of programming an AL5A robotic arm using Matlab. I sent the ASCII codes via the serial port and I opened the serial port using the built-in serial function in Matlab.
However, now I am doing the same project for a different class. But in the class, I need to use C programming. The first thing I need to figure out is how do I open a Serial port using C programming and how do I send ASCII codes? In Matlab I sent the ASCII code by defining it. For example:
I used:
S=serial('COM1', 'BaudRate', 115200);
A= [35 48 80 49 53 48 48 83 48 48 48 13];
fprintf(S, A);
What command do I use using C++ programming to open the serial port and send ASCII codes just like above? Please let me know what header files to use as well.
Thanks,
I accomplished the task of programming an AL5A robotic arm using Matlab. I sent the ASCII codes via the serial port and I opened the serial port using the built-in serial function in Matlab.
However, now I am doing the same project for a different class. But in the class, I need to use C programming. The first thing I need to figure out is how do I open a Serial port using C programming and how do I send ASCII codes? In Matlab I sent the ASCII code by defining it. For example:
I used:
S=serial('COM1', 'BaudRate', 115200);
A= [35 48 80 49 53 48 48 83 48 48 48 13];
fprintf(S, A);
What command do I use using C++ programming to open the serial port and send ASCII codes just like above? Please let me know what header files to use as well.
Thanks,