I'm looking at packing my messages using sprintf, then have f_write to write into the sdcard. However, I'm currently having the issue writing when I'm using the following sprintf(message, "hygro: %d", hygro_reading); suggestions why? I got no problem writing sprintf(message, "hello world");
//Declaration
uint16_t hygr_Data = 0;
int32_t hygr_Reading;
char message[200];
memset(message, NULL, sizeof(message));
const char newline[] = "\n\r";
//part of the code within the for loop.
hygr_Reading = (125*(hygr_Data/65536.0))-6;
UARTprintf("%04x %d, %d\n", hygr_Data, hygr_Data, hygr_Reading);
sprintf(message, "Hygrometer:%d", hygr_Reading);
UARTprintf("%s\n", message);
iFResult = f_write(&fil, message, sizeof(message), &count);
if(iFResult != FR_OK) {UARTprintf("Error writing to file: %s\n", StringFromFResult(iFResult));}
SysCtlDelay(SysCtlClockGet()/3);
iFResult = f_write(&fil, newline, sizeof(newline), &count);
if(iFResult != FR_OK) {UARTprintf("Error writing to file: %s\n", StringFromFResult(iFResult));}
SysCtlDelay(SysCtlClockGet()/3);
iFResult = f_sync(&fil);
if(iFResult != FR_OK) {UARTprintf("Error syncing to file: %s\n", StringFromFResult(iFResult));}
SysCtlDelay(SysCtlClockGet()/3);
memset(message, NULL, sizeof(message));
SysCtlDelay(SysCtlClockGet() / 12);