Required Help in coding to Store Multiple Byte In Arduino UNO By Serial.

hi ,

i am new to use arduino First time and required some help/tips to store Multiple Bytes from Serial Read. i send 232 bytes from my vb App to Arduino by Serial then Read but its store 1 character at a time . Mean split value . like when i send 217 decimal value from application, arduino store 1 then 2 and then 7 . when i read the stored data in application i see arduino store it 1 character per byte.

217 is actually 8bit (1101 1001) in my application and i convert bits in to byte and send to arduino.

Here is my arduino code :

char serInString[232];                          
int  serInIndx  = 0;    
int  serOutIndx = 0;    
const int  buttonPin = 2;
int buttonState = 0;
int lastButtonState = 0;

void readSerialString () {
    int sb;   
    if(Serial.available()) {          
      while (Serial.available()){            
         sb=Serial.read();      
         serInString[serInIndx] =sb;
         serInIndx++;
        } 
      }  
    }

void printSerialString() {
   if( serInIndx > 0) {   
      for(serOutIndx=0; serOutIndx < serInIndx; serOutIndx++) {
          Serial.print( serInString[serOutIndx] );      
      }         
      serOutIndx = 0;
      serInIndx  = 0;
   }
}


void setup() {
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
   serOutIndx=0;
}


void loop () {
 
readSerialString();
buttonState = digitalRead(buttonPin);
  if (buttonState != lastButtonState) {
    if (buttonState ==HIGH) { 
      Serial.println(serInString[serOutIndx]); 
      } 
      else { 
        serOutIndx++; 
        }
    }
lastButtonState = buttonState;
  
}
Serial.parseInt();

See: https://www.arduino.cc/en/Reference/Serial

like when i send 217 decimal value from application, arduino store 1 then 2 and then 7

Is the order jumbling deliberate?

Dear johnwasser thanks for your idea but same result problem not solve .... :confused:

OK, thanks for letting us know. Good luck.

mrsheikh: Dear johnwasser thanks for your idea but same result problem not solve .... :confused:

and the code you used is what ?