bluesky8059

Untitled

Apr 12th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1.                 copyBuffer = new byte[375];
  2.                            
  3.                            
  4.                             //If receive 0xAA, start count how many 0xAA are
  5.                             Console.WriteLine("Hello");
  6.                            
  7.                             while (AAcnt <= 5) {
  8.                             Byte receivedValue = (Byte)port.ReadByte();    
  9.                             // read one byte
  10.                                 if (receivedValue == 0xAA)
  11.                                 {
  12.                                     AAcnt++;
  13.                                    
  14.                                 }
  15.                                 else
  16.                                 {
  17.                                     AAcnt = 0;
  18.                                    
  19.                                 }
  20.                                
  21.                             }
  22.                             port.Read(copyBuffer, 7, 368);
  23.                             AAcnt = 0;
  24.                             Console.WriteLine("hand_cnt:" + hand_cnt);
  25.  
  26.                             for (int i = 7; i < 375; i++)
  27.                                 Console.Write(copyBuffer[i] + ",");
  28.                            
  29.                             Console.WriteLine();
  30.                             hand_cnt++;
  31.                             if (hand_cnt == 100)
  32.                                 hand_cnt = 0;
Advertisement
Add Comment
Please, Sign In to add comment