i would like to put my serial char result inside char* with concatenation function.
But i have a 2 problem problemes :
CORRUPT HEAP: Bad tail
CORRUPT HEAP: multi_heap.c:432
i think it's overload but i initialize my pointer with 15 octets and normaly it's enought.
- void Wisol::getID()
- {
- printf("getID");
- char * data=(char *) malloc(15);
- char receive;
- *(data)='\0';
- Serial2.begin(9600, SERIAL_8N1, RXPin, TXPin);
- Serial2.println("AT$I=10");
- delay(1000);
- while (Serial2.available()) {
- //Serial.println(char(Serial2.read()));
- delay(100);
- receive= Serial2.read();
- printf("data: %c \n",receive);
- strcat( data, &receive );
- }
- free(data);
- }