mtt.tr
Member
- Messages
- 8,428
- Location
- Essex/Suffolk border
I'm working on a personal project/ prototype, it involves reading serial data and splitting and using the data if set elements are achieved.
The incoming data comes in as a string of I,101((upwards)),s,((any letter))1,1,1,1,1,1,1,1,E
I = initialise using an if statement
101= used as the comms address for each device up to 30 odd devices
**
S is to prepare for string to be parse and stored to integers
numbers after that get written as integers to be used by the rest of the code control either a servo or switch inputs high
Or on other devices S is used to prepare them to serial.print their integers for visual studio to write into other parts of code to control simconnect I'm not this far yet
E ends the serial print and makes it listen again
Each device is controlled individually and commanded by the computer they will not send data unless requested as this will be done using rs485 and the computer will not execute the next chunk until its told to.
Now I can do arduino parts they are proving to be reliable and behave as expected
Where im having trouble is in visual studio using c#, im writing the info as a string from the arduino then splitting it followed by converting to seperate integers which will be used to set simconnect , the real issue im having is the serial data is not lasting it is immediately changing to nothing before ive actually split the data and used the integers
Whilst writing i think i know where im going wrong and will try, any suggestions are much appreciated.
The incoming data comes in as a string of I,101((upwards)),s,((any letter))1,1,1,1,1,1,1,1,E
I = initialise using an if statement
101= used as the comms address for each device up to 30 odd devices
**
S is to prepare for string to be parse and stored to integers
numbers after that get written as integers to be used by the rest of the code control either a servo or switch inputs high
Or on other devices S is used to prepare them to serial.print their integers for visual studio to write into other parts of code to control simconnect I'm not this far yet
E ends the serial print and makes it listen again
Each device is controlled individually and commanded by the computer they will not send data unless requested as this will be done using rs485 and the computer will not execute the next chunk until its told to.
Now I can do arduino parts they are proving to be reliable and behave as expected
Where im having trouble is in visual studio using c#, im writing the info as a string from the arduino then splitting it followed by converting to seperate integers which will be used to set simconnect , the real issue im having is the serial data is not lasting it is immediately changing to nothing before ive actually split the data and used the integers
Whilst writing i think i know where im going wrong and will try, any suggestions are much appreciated.