10 years, 10 months ago.

Why can't I pass variable to function?

Hi

I'm writing a library for SIM900. I've got a function to read a message, but somehow it can't do a simple 'printf' when using additional arguments:

Snippet that doesn't work

char* SIM900::readMessage(char messagenumber)
{
    _serial.printf("AT+CMGR=%c",messagenumber);
    return _atcmdc("\r", "OK\r\n", 2000);
}

I have tried a lot of different options now, trying to pass chars, char, bytes, everything. From my main I do this:

main.cpp for SIM900

if(strstr(GSM.readMessage('1'), "START1")){
     LED2 = 1;
}

Sniffing the serial port says that the char is not transferred. This is weird or is it me?

Thanks in advance. Lerche

Be the first to answer this question.