FString UMyBlueprintFunctionLibrary::BodyTurn(float& uparm, FString zeros)
{
float ars;
HANDLE hCom1 = init_com("COM3");
/*發送模塊
string result="233";
WriteFile(hCom1, result.data(), result.size(), NULL, NULL);
*/
string result = "";
//try
//{
char buf[100] = { 0 };
DWORD readsize = 80;
//int n = 10;
//while (n > 0) {
ReadFile(hCom1, buf, 80, &readsize, NULL);
/*cout << buf;*/
for (int i = 0; i < 80; i++)
{
result += buf[i];
}
int uparml = result.find_first_of("A:") + 2;//找到A:
result.erase(0, uparml); //從0位開始到A:的字符
int end = result.find_first_of(",0");//找到\n
result.erase(end); //洗掉end位后面的所有字符
ars = atof(result.c_str());
ars = ars * 360 / 32767;
/* }*/
//catch (const std::exception&)
//{
// ars = 180;
//}
/* }*/
// system("pause");
//return 0;
uparm = ars;
zeros = 0;
return zeros;
}
uj5u.com熱心網友回復:
解析度或重繪率調得太高引起 修改一下電腦的解析度試試轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/270029.html
標籤:C++ 語言
上一篇:即使使用thread 呼叫system()是阻塞的嗎, 但是也沒辦法實作多執行緒發送報文?!
下一篇:37個人圍城一圈,編上號碼(1~37),第一個人從1數起,數到5的人被淘汰,接下來的人繼續數,最后剩下的人為贏家
