SMS reciving by basic stamp!!!!!!
karim10216
Posts: 2
what is the statment to makeGSM receive sms and command basic stamp to control a pin????
i tried this but didnt help,
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[ I/O Definitions ]
GPRS_RX PIN 1 'Connected with Pin Tx in Gsm Module
GPRS_TX PIN 0 'connected with Pin Rx in Gsm Module
'
[ Constants ]
T9600 CON 84
GPRS_Baud CON T9600
'
Mode VAR Word
'
SMS_Prep:
PAUSE 500
SEROUT GPRS_TX, GPRS_Baud, ["AT+CMGF=1", CR]
SERIN GPRS_RX, GPRS_Baud, 3000, SMS_Prep, [WAIT("OK")]
DO
SERIN GPRS_RX, GPRS_Baud,[WAIT("!"),Mode]
IF Mode = "A" THEN
HIGH 15
ENDIF
LOOP
plz help me!!!!!
i tried this but didnt help,
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[ I/O Definitions ]
GPRS_RX PIN 1 'Connected with Pin Tx in Gsm Module
GPRS_TX PIN 0 'connected with Pin Rx in Gsm Module
'
[ Constants ]
T9600 CON 84
GPRS_Baud CON T9600
'
Mode VAR Word
'
SMS_Prep:
PAUSE 500
SEROUT GPRS_TX, GPRS_Baud, ["AT+CMGF=1", CR]
SERIN GPRS_RX, GPRS_Baud, 3000, SMS_Prep, [WAIT("OK")]
DO
SERIN GPRS_RX, GPRS_Baud,[WAIT("!"),Mode]
IF Mode = "A" THEN
HIGH 15
ENDIF
LOOP
plz help me!!!!!
Comments
What's the application, exactly?
Ken Gracey
I am using this to control a relay by sms meg, to turn on and off the lights....
this is software
' {$STAMP BS2}
' {$PBASIC 2.5}
A VAR Word
'================================================= ================================================== ====
'
main routine
'================================================= ================================================== ====
frist:
PAUSE 500
SEROUT 14 ,84, ["AT+CMGD=1,4",13,10] ' Delect All messages
SERIN 15, 84 , [WAIT("OK")]
MAIN:
PAUSE 500
SEROUT 14 , 84, ["AT+CMGF=1", 13,10] ' Text mode
SERIN 15 , 84,3000,MAIN, [WAIT("OK")]
SECOND:
PAUSE 500
SEROUT 14,84, ["AT+CNMI=1,2,0,0,0",13,10] ' Read all messages
SERIN 15 , 84,3000,SECOND,[WAIT("OK") ]
THRID:
DO
SERIN 15 , 84, [WAIT(">"),A]
IF A = "A" THEN
HIGH 0 'when received A message
SMS_Prep:
PAUSE 500
SEROUT 14, 84, ["AT+CMGF=1", CR]
SERIN 15, 84, 3000, SMS_Prep, [WAIT("OK")] ' Text mode
SMS:
PAUSE 500
SEROUT 14,84, ["AT+CMGS=", $22, "39922358", $22, CR] ' Send to this phone number
SERIN 15, 84, 3000, SMS, [WAIT(">")]
SMS2:
PAUSE 500
SEROUT 14, 84, ["The Light's Number 1 is on!", $1A] ' Data to be send
SERIN 15, 84, 5000, SMS2, [WAIT("OK")]
GOTO THRID
ENDIF
LOOP
We're a little confused here. Are you and karim10216 the same person?
Thanks,
-Phil
No kidding?
Well, I think that the "smart money" is betting on your having logged in on two accounts.
Also in the code below I have just set a long modem startup delay. The modem is actually fairly verbose when initializing, it reports all sorts of info related to it's connection status, etc. For simplicity in setup here I just have a PAUSE 50000 to let it do it's dance and come ready, but if you want to monitor the startup, you certainly can. See the SM5100B manual for detailed descriptions of the codes it puts out.
The SM5100B is very user friendly, but not it's pinout. I highly suggest you also pick up the breakout board for the unit from SparkFun. It not only has the SM5100B socket, but also the SIM Card socket, and all interconnects, etc. The breakout board comes ready to talk to your COMPUTER via the built-in USB port on the card. You MUST unsolder the microjumpers on the board (RX, DTR, RTS, TX, and CTS) in order to talk to the unit with a microcontroller.
I'll answer any questions you may have on this code, but it's up to you to read the SM5100B and AT Command manual, which is specific for the unit, and will probably answer any questions you may have on the code, since in reality the code is basically just SEROUTs of AT Commands, and SERINs of acknowledgements or received data/texts.
Happy Texting!
Dave