OUTPUT STRING OF CHARACTERS to ARDUINO

I have a c++ script running on BBB. I want the code to send output through uart to a arduino. I have no idea how to go about doing this. What functions do I use in c++ to send output over uart.

This is my code:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include “iostream”
#include <stdio.h>
#include <stdlib.h>
#include

using namespace cv;
using namespace std;
/// Global variables

int threshold_value = 0;
int threshold_type = 3;;
int const max_value = 255;
int const max_type = 4;
int const max_BINARY_value = 255;
/*int thresh = 100;
int max_thresh = 255;
RNG rng(12345);
/
char
trackbar_value= “Value”;
Mat src, src_gray, dst;

char* window_name = “Threshold Demo”;
/// Function header
void Threshold_Demo(int, void* );

int main()
{
VideoCapture webcam;
webcam.open(0);
webcam.set(CV_CAP_PROP_FRAME_WIDTH, 160);
webcam.set(CV_CAP_PROP_FRAME_HEIGHT, 120);
// webcam.set(CV_CAP_PROP_FPS, 5);

if(!webcam.isOpened())//EDITED
{
cout<<“CANNOT OPEN CAM”<<endl;
return -1;
}

double size = webcam.get(CV_CAP_PROP_MODE);
printf("lalal %f \n \n ", size);
namedWindow(window_name, CV_WINDOW_NORMAL );

while(true)
{
do
{
webcam >> src;
}while(src.empty());

cvtColor(src, src_gray, CV_BGR2GRAY);

char* source_window = “Source”;
namedWindow( source_window, CV_WINDOW_NORMAL );
createTrackbar(trackbar_value,source_window,&threshold_value, max_value, Threshold_Demo);
imshow( source_window, src );
Threshold_Demo( 0, 0 );
waitKey(100);

}
return 0;
}
void Threshold_Demo( int, void* )
{
/* 0: Binary
1: Binary Inverted
2: Threshold Truncated
3: Threshold to Zero
4: Threshold to Zero Inverted
*/

threshold( src_gray, dst, threshold_value, max_BINARY_value,0);

imshow(window_name, src_gray);

CvMoments colorMoment;
colorMoment = moments(dst);
printf(“hahahrah %f \n \n \n”, dst.size().width);

double moment_x = colorMoment.m10/colorMoment.m00;
double moment_y = colorMoment.m01/colorMoment.m00;
printf(“1. x-center %f y-center %f \n \n \n \n” , moment_x , moment_y);

}

Sorry to be pedantic, but C++ is not a scripting language. It compiles to native code.

Anyhow . . .

This is not a beaglebone specific question / answer. You really need to learn how UART works. On the beaglebone / Linux side you only need to output characters to the tty device ( or read them in). just like you would with any other file. It is really simple. So simple a single google session should turn up many, many results.

Passed that Arduino discussion is outside the scope of this forum, and I suggest you either pose that question on some arduino forum, or read some arduino related article on the subject.