sharing and need advise - sms and temperature sensor
Archiver
Posts: 46,084
hi everyone,
l'm half way through my project, and i would like to share with u all
what i have. l'm linking my project with siemens TC35 modem, amulet
LCD and STAMP.
the following souce code that l'm sharing with u all would be that
when a sms is receive from the modem, it would display on the LCD and
send back a message.
here is the souce code:
======================================================================
'{$STAMP BS2p}
SEROUT 0, 18447, [noparse][[/noparse]"AT+CMGF=1", CR] 'set text mode
SERIN 3, 18447, [noparse][[/noparse]WAIT("OK")] 'wait for text mode ok reply
start:
PAUSE 2000
SEROUT 0, 18447, [noparse][[/noparse]"AT",43,"CMGL=", 34,"rec unread", 34, CR] 'read
unread msg,stored it to be forever UNREAD
SerString VAR Byte(6)
SERIN 3, 18447,1000, start, [noparse][[/noparse]WAIT("z"),STR SerString\5] 'if "z"
no appear, program goes back to function start
IF SerString(0) = "d" THEN loop2
IF SerString(0) <> "d" THEN LCDerror
loop2:
IF SerString(1) = "a" THEN loop3
IF SerString(1) <> "a" THEN LCDerror
loop3:
IF SerString(2) = "w" THEN loop4
IF SerString(2) <> "w" THEN LCDerror
loop4:
IF SerString(3) = "e" THEN loop5
IF SerString(3) <> "e" THEN LCDerror
loop5:
IF SerString(4) = "n" THEN LCDdisplay
IF SerString(4) <> "n" THEN LCDerror
'DEBUG STR SerString
GOTO start
'
LCDdisplay:
SEROUT 16,1,[noparse][[/noparse]215,48,48,STR SerString\5,0]
SEROUT 16,1,[noparse][[/noparse]215,48,50,STR SerString\5,0]
GOSUB send_sms
RETURN
'
send_sms:
asd VAR Byte(11)
SEROUT 0, 18447, [noparse][[/noparse]"AT+CMGF=1", CR] 'set text mode
PAUSE 300
SEROUT 0, 18447, [noparse][[/noparse]"AT+CMGS=", 34,"+6592396325", 34,CR] 'send msg
PAUSE 1000
SEROUT 0, 18447, [noparse][[/noparse]"neopet", 26]
SERIN 3, 18447, [noparse][[/noparse]STR asd\10] 'for the modem to reply
RETURN
'
LCDerror:
SEROUT 16,1,[noparse][[/noparse]215,48,48,"error",0]
SEROUT 16,1,[noparse][[/noparse]215,48,50,"error",0]
'GOSUB send_sms
GOTO start
=====================================================================
i would like to have some help here.
1)how do i reply the sms that the sender send? it is because in my
program, i define the sender hp no. and i would like my program to
reply to any sender who send the sms.
2)i would like to include in my project a temperature sensor. and my
teacher have brought me a digital temperature sensor (DS1624).
do anyone have the souce code for it?
All reply and help is appreciated.
Regards
Ben
l'm half way through my project, and i would like to share with u all
what i have. l'm linking my project with siemens TC35 modem, amulet
LCD and STAMP.
the following souce code that l'm sharing with u all would be that
when a sms is receive from the modem, it would display on the LCD and
send back a message.
here is the souce code:
======================================================================
'{$STAMP BS2p}
SEROUT 0, 18447, [noparse][[/noparse]"AT+CMGF=1", CR] 'set text mode
SERIN 3, 18447, [noparse][[/noparse]WAIT("OK")] 'wait for text mode ok reply
start:
PAUSE 2000
SEROUT 0, 18447, [noparse][[/noparse]"AT",43,"CMGL=", 34,"rec unread", 34, CR] 'read
unread msg,stored it to be forever UNREAD
SerString VAR Byte(6)
SERIN 3, 18447,1000, start, [noparse][[/noparse]WAIT("z"),STR SerString\5] 'if "z"
no appear, program goes back to function start
IF SerString(0) = "d" THEN loop2
IF SerString(0) <> "d" THEN LCDerror
loop2:
IF SerString(1) = "a" THEN loop3
IF SerString(1) <> "a" THEN LCDerror
loop3:
IF SerString(2) = "w" THEN loop4
IF SerString(2) <> "w" THEN LCDerror
loop4:
IF SerString(3) = "e" THEN loop5
IF SerString(3) <> "e" THEN LCDerror
loop5:
IF SerString(4) = "n" THEN LCDdisplay
IF SerString(4) <> "n" THEN LCDerror
'DEBUG STR SerString
GOTO start
'
LCDdisplay:
SEROUT 16,1,[noparse][[/noparse]215,48,48,STR SerString\5,0]
SEROUT 16,1,[noparse][[/noparse]215,48,50,STR SerString\5,0]
GOSUB send_sms
RETURN
'
send_sms:
asd VAR Byte(11)
SEROUT 0, 18447, [noparse][[/noparse]"AT+CMGF=1", CR] 'set text mode
PAUSE 300
SEROUT 0, 18447, [noparse][[/noparse]"AT+CMGS=", 34,"+6592396325", 34,CR] 'send msg
PAUSE 1000
SEROUT 0, 18447, [noparse][[/noparse]"neopet", 26]
SERIN 3, 18447, [noparse][[/noparse]STR asd\10] 'for the modem to reply
RETURN
'
LCDerror:
SEROUT 16,1,[noparse][[/noparse]215,48,48,"error",0]
SEROUT 16,1,[noparse][[/noparse]215,48,50,"error",0]
'GOSUB send_sms
GOTO start
=====================================================================
i would like to have some help here.
1)how do i reply the sms that the sender send? it is because in my
program, i define the sender hp no. and i would like my program to
reply to any sender who send the sms.
2)i would like to include in my project a temperature sensor. and my
teacher have brought me a digital temperature sensor (DS1624).
do anyone have the souce code for it?
All reply and help is appreciated.
Regards
Ben