I am working on a project in which I have set up a serial communication between Arduino and C# window form application. When I send a start command to Arduino, Arduino starts rotating the servo motor attached to it and sends the angle position to c# in a continuous manner.
Now while Arduino is sending the data to C#, I request a variable data stored in Arduino at a random time at the same serial port and I want to log that variable data in my c#.i can log whatever data is being received on serial port but I can't select and extract that particular variable.
Can anyone please help me with that?
I'll just lay this out here. Picking up where jdweng left off, your messages also need to contain messaging protocol state information. Once this information has been included, you will be able to de-serialize any message in any order because the information required to process it is contained in the message.
Here is an example protocol.
Message -
So your angle message would consist of three parts Length, Type, and Value
AngleMessage
ParameterMessage
MessageBody = {
}
Using this scheme your message contains all the information you need to process it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.