Reputation: 199
I'm working on a face detection robot project.I'm using opencv software to detect faces. When the face is detected i want to get the x-y coordinates and send them to an arduino board.
The arduino has two dc motors connected. The first dc motor will spin a base (the base of a robot's head) according to y-coordinates (y-axis).
The second dc motor will handle the x-coordinates on the x-axis (i want to make the robot's eyes go up and down).
I work with the code on eclipse (kepler), my os is ubuntu 12.04 and i have an arduino uno. My source code is written in c++ and opencv. The arduino is connected with my pc through USB port.
My question is how can i take the x-y coordinates from my opencv source code in order to transfer them to arduino?
And how can i receive and handle the coordinates in arduino?
Upvotes: 0
Views: 642
Reputation: 706
You need some way to interface with USB serial ports from your C++ code. A quick Google search leads me to this C++ serial library for Ubuntu: libserial-dev.
On the Arduino side, you certainly want to look at the Arduino Serial interface to receive the data you're sending.
To follow that up, look for a tutorial on basic usage. Start with a simple "Hello World" and then try to echo back and forth between your C++ code and your Arduino. Then, it's up to you to design your data transfer protocol.
Upvotes: 1