Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
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