windows - Passing serialport data data in a buffer/variable in C++ -


I have data from a serial port with 3 sensors I

  sensor0, sensor 1, Sensor 2   

I use this program:

  #include & lt; Iostream & gt; #include & lt; String & gt; # Include & lt; Sstream & gt; #include & lt; Windows.h & gt; #include "SerialClass.h" four buffers [25]; using namespace std; Int i; Int main () {Serial Osial ("COM8:"); OSerial.WriteData ("1", 1); Sleep (100); OSerial.ReadData (buffer, 25); String str = buffer; String word; String Stream Stream (ARR); While (gateline (stream, word, ',')) cout & lt; & Lt; The word & lt; & Lt; "\ N"; Sleep (10000); }   

And the result is:

  sensor sensor 1 censor 2   

I want the result of the data to be a buffer / Variable then the result shows

  y1 = sensor0 y2 = sensor1 y3 = sensor2   

How can I change the code so that the result is such that

In the code snippet:

  int count = 1; While (Galeline (stream, word, ',')) {cout and lt; & Lt; "Y" & lt; & Lt; Count & lt; & Lt; "=" & Lt; & Lt; The word & lt; & Lt; "\ N"; Count ++; }    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -