Arduino sending sms in GSM sim900 error -
i have arduino mega 2560 , sim900 gsm module. interfaced them , written code. working, can send 1 sms @ time in while loop. means when write while loop execute sendsms() 5 times using while loop. 1 sms sent.. , stops...
the code below:
#include <softwareserial.h> #include <string.h> softwareserial myserial(52, 53); void setup() { myserial.begin(19200); // gprs baud rate serial.begin(19200); // gprs baud rate delay(500); } int x = 0; loop() { while (x<5) { sendtextmessage(); x++; } } void sendtextmessage() { myserial.print("at+cmgf=1\r"); delay(100); myserial.println("at + cmgs = \"+94776511996\""); delay(100); myserial.println("hey wow"); delay(100); myserial.println((char)26); delay(100); myserial.println(); }
you can't dump @ commands @ sim900 100ms delay, , expect work. sim900 responds @ commands (typically "ok"), , should wait response before issuing next command. can getaway ignoring these responses if provide enough delay between @ commands make sure every command sent after sim900 had enough time respond previous one. make quick verification of this, add delay(10000) - 10 seconds delay - @ end of sendtextmessage() function. (probably) give sim900 enough time complete sms transmission before moving on next one.
Comments
Post a Comment