开发者

serial port receiving data manipulation

In my application I am receiving data serially from com3 it is an integer variable, now I want to transfer this data in a form of string to com1 the string will be like "#0 Pa" here a is integer value received from 'com3'.

I know how to receive and send data serially my code is working fine with it, but I am struck how can I form string code so it automatically take integer value received from com3 and send to com1, basically how I can formed st开发者_开发知识库ring with a variable value received and some character which are constant.


My question is: how do you receive the integer? Usually data is transferred as strings.

In case you do have it as an integer,

int receivedPar = ...;
string messageToSend = string.Format("#0 P{0}", receivedPar);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜