how to add byte by byte to a String

what I do wrong

int inByte = 0; char inLine[10] ="";

void setup() { Serial.begin(9600);


void loop() {

if (Serial.available() > 0) { inByte =; Serial.print(inByte, BYTE);

char inLine[] =+ inByte); //????????????????????

Serial.println(inLine); } }

char inLine[]  =+ inByte);

Some very odd syntax and unmatched parentheses there.

You need an index:

  int index;  // declare a string position pointer

  index = 0;  // every time we start a new string, reset the pointer
  inLine[index++]  = inByte; // put the character in the next free slot.           
  inLine[index]      = '\0';  // always terminate your strings.

Add a dash of bounds checking to taste, and bake in a warm Arduino.

char inLine[] =+ inByte); //????????????????????

1) Don't redefine it as char 2) Keep track of how many bytes you have already received 3) Add each new byte to the array with:- inLine = inByte; i++; (yes you can do this in one line but it is easer to understand as two operations.



inLine = inByte; i++ works perfekt