Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何从c++;去Arduino?_C++_Arduino_Serial Port - Fatal编程技术网

C++ 如何从c++;去Arduino?

C++ 如何从c++;去Arduino?,c++,arduino,serial-port,C++,Arduino,Serial Port,请帮帮我。这是我的程序和输出。但是有这么多的噪音像这样: -168.p?C?LHm?O%?O???X?P 我的节目: float yaw, pitch, roll; quaternion.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll); wzPrintf(20, 110, "Yaw:%d, Pitch:%d, Roll:%d", yaww, pitchh, rolll); yaws = (

请帮帮我。这是我的程序和输出。但是有这么多的噪音像这样:

-168.p?C?LHm?O%?O???X?P

我的节目:

float yaw, pitch, roll;
quaternion.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch, &roll);
wzPrintf(20, 110, "Yaw:%d, Pitch:%d, Roll:%d", yaww, pitchh, rolll);
yaws = (int)RadToDegree(yaw);
pitchs = (int)RadToDegree(pitch);
rolls = (int)RadToDegree(roll);
yaww = (int)RadToDegree(yaw);
pitchh = (int)RadToDegree(pitch);
rolll = (int)RadToDegree(roll);
char out[10];
SerialPort arduino(port_name);
if (arduino.isConnected()) { wzPrintf(20, 130, "Connection established"); }
else wzPrintf(20, 130, "ERROR, check port name");
sprintf_s(out, "%d", yaww);
arduino.writeSerialPort(out, MAX_DATA_LENGTH);
浮动偏航、俯仰、横摇;
四元数。GetEulerAngles(偏航、俯仰和滚动);
wzPrintf(20110,“偏航:%d,俯仰:%d,横滚:%d”,横滚,横滚,横滚,横滚);
yaws=(int)RadToDegree(偏航);
俯仰=(int)RadToDegree(俯仰);
转鼓=(int)RadToDegree(转鼓);
yaww=(int)RadToDegree(偏航);
俯仰高度=(int)RadToDegree(俯仰);
roll=(int)RadToDegree(roll);
字符输出[10];
SerialPort arduino(端口名称);
if(arduino.isConnected()){wzPrintf(20130,“连接已建立”);}
else wzPrintf(20130,“错误,检查端口名”);
冲刺队(出局,“%d”,yaww);
arduino.writeSerialPort(输出,最大数据长度);

不要发送整个缓冲区。
我认为这应该做到:

arduino.writeSerialPort(out, strlen(out));