Hello,
I have a package of data coming from the serial port and read out as a string.
The package has the following format, to be short.
1. opening characters
2. 2 bytes for Group ID(identify the device# the data comes from).
3. Sensors data belongs to device# (1 byte each)
-data of sensor #1
-data of sensor #2
-data of sensor #3
-data of sensor #4
and loop back to sensor 1,2,3,4 for 20 bytes total.
I have eliminated the opening characters with the replace substring with empty string. For the Group ID, I used a case structure to identify which device it is. For the sensor data, I need to split them up and group all the data of the sensors together. I tried using substring for each sensor in a for loop that loop 5 times to group the data of each sensor together but it only give me the very last values.
My goal is to be able to extract and group the 5 bytes of each sensor together everytime the serial package comes in and then save them to a separte files for each sensor. I also want to be able to plot the data of each sensor as they come in with respect to time.
Any idea on how I can accomplish the grouping of data described above? I really appreciate your prompt response. Thanks,