Skip to main content
added 120 characters in body
Source Link

I was read all comments on this question, but all codes was share so verbosing. After that, i create a code with simple functions and less of line. in this case, i think this code workwill working fine

if you set baudrate under 115200, must be add delay() for saving message to char array

void loop() {
    char data[255];
    uint8_t k = 0;
    while (Serial.available()) {
        data[k] = Serial.read();
         k++;
    }
    for (int i = 0; i < k; i++) {
        Serial.print(data[i]);
        data [i] = '\0';
    }
    //delay(50);
}

I was read all comments on this question, but all codes was share so verbosing. After that, i create a code with simple functions and less of line. in this case, i think this code work fine

void loop() {
    char data[255];
    uint8_t k = 0;
    while (Serial.available()) {
        data[k] = Serial.read();
         k++;
    }
    for (int i = 0; i < k; i++) {
        Serial.print(data[i]);
        data [i] = '\0';
    }
}

I was read all comments on this question, but all codes was share so verbosing. After that, i create a code with simple functions and less of line. in this case, i think this code will working fine

if you set baudrate under 115200, must be add delay() for saving message to char array

void loop() {
    char data[255];
    uint8_t k = 0;
    while (Serial.available()) {
        data[k] = Serial.read();
         k++;
    }
    for (int i = 0; i < k; i++) {
        Serial.print(data[i]);
        data [i] = '\0';
    }
    //delay(50);
}
revision
Source Link

I was read all comments on this question, but all codes was share so verbosing. After that, i create a code with simple functions and less of line. in this case, i think this code work fine

void loop() {
    char data[]data[255];
    uint8_t k = {};0;
    while (Serial.available()) {
    int lop   data[k] = Serial.availableread();
    for (int i = 0; i < lop; i++) {k++;
    }
    char c =for Serial.read();
  int i = 0; i < data[i]k; =i++) c;{
        Serial.print(data[i]);
        data [i] = '\0';
    }
  }
}

I was read all comments on this question, but all codes was share so verbosing. After that, i create a code with simple functions and less of line. in this case, i think this code work fine

void loop() {
  char data[] = {};
  while (Serial.available()) {
    int lop = Serial.available();
    for (int i = 0; i < lop; i++) {
        char c = Serial.read();
        data[i] = c;
        Serial.print(data[i]);
        data [i] = '\0';
    }
  }
}

I was read all comments on this question, but all codes was share so verbosing. After that, i create a code with simple functions and less of line. in this case, i think this code work fine

void loop() {
    char data[255];
    uint8_t k = 0;
    while (Serial.available()) {
        data[k] = Serial.read();
         k++;
    }
    for (int i = 0; i < k; i++) {
        Serial.print(data[i]);
        data [i] = '\0';
    }
}
Source Link

I was read all comments on this question, but all codes was share so verbosing. After that, i create a code with simple functions and less of line. in this case, i think this code work fine

void loop() {
  char data[] = {};
  while (Serial.available()) {
    int lop = Serial.available();
    for (int i = 0; i < lop; i++) {
        char c = Serial.read();
        data[i] = c;
        Serial.print(data[i]);
        data [i] = '\0';
    }
  }
}