I am working on a small 3D rotational scanner, I have had most of the code which takes a picture using a webcam and processing them written in C++ and to be executed on a PC, as it requires a lot of memory. However, I need to use Arduino to drive and control a stepper motor which will do the rotation of the actual object to be scanned.
The problem I am facing is that I need to have the Arduino to wait for the C++ program to do its capturing and processing before it can use the stepper motor. Is there some sort of an acknowledge bit or some memory that both my C++ program and the Arduino processor can access and share? How can this be achieved?
I am new to using Arduino and please let me know if there is anything I need to clarify in my question. Thanks in advance,
And can you please tell me how to do that, without needing to recompile the Arduino program during the process? Any links or examples are much appreciated.
You need to design a suitable protocol for communication between the PC and the Arduino. This should define the details of the messages the PC will send to the Arduino and the details of messages the Arduino will send to the PC.
Then you need to write code for your PC program and for your Arduino to give effect to that.
If you provide some examples of the messages you want to send we can help with the Arduino code.
In the meantime the examples (especially the 3rd example) in serial input basics may give you some ideas.