Tool/software: Code Composer Studio
Hello everybody,
I am working with the sensor/actuator example and I am trying to print the 8 bytes of the MAC address of the sensor sending data to the collector.
Doing this:
LCD_WRITE_STRING_VALUE("Sensor 0x", (uint16_t)* pMsg->extAddr, 16, 6); Prints the first 2 bytes.
LCD_WRITE_STRING_VALUE("Sensor 0x", (uint16_t)* (pMsg+1)->extAddr, 16, 6); Prints the second 2 bytes and so on...
But I want to send it in one line. So I tried this:
char extAddress_array[20]; for(int i=0; i < 7; i++) { sprintf(&extAddress_array[2*i],"%02X", *(pMsg+i)->extAddress); } extAddress_array[19] = '\0'; System_printf((xdc_CString) extAddress_array); System_printf("\r\n");
The code works if I put in chars into the "extAddress_array" manually, but using sprintf seems not to do the trick, because running this code just causes the collector to stop printing anything via UART.
Can someone of you find the mistake? Or give me another elegant solution to print the extAddress of the sensor by the collector via UART?
kind regards
Stefan