
With the READSMS command, a BASIC skript can read SMS (Short Message Service) messages that are stored onto the SIM card of the GSM-Modem. READSMS requires two string variables as arguments. After a successfull call to READSMS, the first variabe contains the sender's address (mobile phone number), while the second variable contains the message text.
outmode -2
let a$ = ""
let b$ = ""
readsms a$, b$
if LASTERR = 0 then
print "Got SMS from: ";
print a$
print "Text: ";
print b$
end if
end
On reading, a SMS-message is deleted from the SIM-card so it cannot be read twice. Messages are read in time-reverse order, that means the youngest message is read first. If there are no more messages stored, both strings will contain "NONE" and LASTERR is set to 8 (NO_DATA).
The maximum length of an incoming message is the default string length (of 255 bytes). Longer messages are truncated.
READSMS is available on firmware version 5.06 and above. The module must have as GSM modem.