'{$STAMP BS2} 'STAMP directive (specifies a BS2) Btna VAR BYTE Btnb VAR BYTE GOSUB INIT Loop: DEBUG "LOOP",CR BUTTON 4,1,255,250,Btna,1,TEST 'loop to look for one of the rf remotes to go high BUTTON 3,1,255,250,Btnb,1,TEST 'There are two inputs from the rf remote, they connect to pin 3 and 4 GOTO Loop TEST: DEBUG "TEST",CR FREQOUT 1,200,3000 IF IN4=1 AND IN3=1 THEN EMGTEST ' test to see if both buttons are pressed PAUSE 4000 IF IN4=1 or IN3=1 THEN HELP 'test to see if just one button is pressed FREQOUT 1,200,4000 'generate some beeps to let her know the press was detected FREQOUT 1,20,0 FREQOUT 1,200,4000 FREQOUT 1,20,0 GOTO Loop RETURN EMGTEST: DEBUG "EMGTEST" ,CR PAUSE 4000 IF IN4=1 AND IN3=1 THEN EMG 'Loop to test that both buttons are pressed FREQOUT 1,200,4000 'that indicates an emergency request FREQOUT 1,20,0 FREQOUT 1,200,4000 FREQOUT 1,20,0 GOTO Loop RETURN EMG: DEBUG "EMG",CR 'If both buttons are pressed, you will end up here FREQOUT 1,200,3200 FREQOUT 1,200,2800 PAUSE 4000 SEROUT 15, 84, ["ATDxxxxxx2222;",13,10] ' This is the AT command to dial (D) the following number and then add a CR/LF GOSUB NEXTCALL FREQOUT 1,200,3000 PAUSE 100 FREQOUT 1,200,3000 SEROUT 15, 84, ["ATH",13,10] 'Hang up and call dad PAUSE 1500 FREQOUT 1,200,4000 FREQOUT 1,20,0 FREQOUT 1,200,4000 FREQOUT 1,20,0 SEROUT 15, 84, ["ATDxxxxxx9938;",13,10] 'Calling dad.. GOSUB NEXTCALL FREQOUT 1,200,3000 PAUSE 100 FREQOUT 1,200,3000 SEROUT 15, 84, ["ATH",13,10] PAUSE 1500 FREQOUT 1,200,4000 FREQOUT 1,20,0 FREQOUT 1,200,4000 FREQOUT 1,20,0 GOTO LOOP RETURN HELP: DEBUG "HELP",CR 'This is the procedure for calling healthcare and home/dad FREQOUT 1,200,2500 FREQOUT 1,200,2000 PAUSE 4000 SEROUT 15, 84, ["ATDxxxxxx8660;",13,10] 'Call in-home healthcare with ATD code and then add CR/LF GOSUB NEXTCALL FREQOUT 1,200,3000 PAUSE 100 FREQOUT 1,200,3000 SEROUT 15, 84, ["ATH",13,10] 'ATH = hang up PAUSE 1500 FREQOUT 1,200,4000 FREQOUT 1,20,0 FREQOUT 1,200,4000 FREQOUT 1,20,0 SEROUT 15, 84, ["ATD8179969938;",13,10] 'Call dad with the ATD code and then add CR/LF GOSUB NEXTCALL FREQOUT 1,200,3000 PAUSE 100 FREQOUT 1,200,3000 SEROUT 15, 84, ["ATH",13,10] 'ATH = hang up PAUSE 1500 FREQOUT 1,200,4000 FREQOUT 1,20,0 FREQOUT 1,200,4000 FREQOUT 1,20,0 SEROUT 15, 84, ["ATDxxxxxx3082;",13,10] 'Call out home and add CR/LF GOSUB NEXTCALL FREQOUT 1,200,3000 PAUSE 100 FREQOUT 1,200,3000 SEROUT 15, 84, ["ATH",13,10] 'ATH = hang up PAUSE 1500 FREQOUT 1,200,4000 FREQOUT 1,20,0 FREQOUT 1,200,4000 FREQOUT 1,20,0 GOTO LOOP RETURN NEXTCALL: DEBUG "NEXTCALL" ,CR BUTTON 4,1,255,250,Btna,0,NEXTCALL RETURN INIT: DEBUG "INT",CR HIGH 0 PAUSE 4000 LOW 0 PAUSE 60000 HIGH 0 PAUSE 200 LOW 0 PAUSE 200 HIGH 0 PAUSE 200 LOW 0 PAUSE 200 HIGH 0 PAUSE 200 LOW 0 PAUSE 200 HIGH 0 PAUSE 200 LOW 0 PAUSE 200 HIGH 0 PAUSE 200 LOW 0 PAUSE 200 HIGH 0 PAUSE 200 LOW 0 PAUSE 200 HIGH 0 PAUSE 200 LOW 0 SEROUT 15, 84, ["ATS0=1;",13,10] 'ATSO, is an AT code that sets the phone for auto answer with 0 rings. FREQOUT 1,200,3500 'This allows me to call the phone and it will auto answer without ringing FREQOUT 1,200,0 'Good for emergencies to make sure she is OK, if we cannot reach her by phone FREQOUT 1,200,3500 FREQOUT 1,200,0 FREQOUT 1,200,3500 FREQOUT 1,200,0 FREQOUT 1,200,3500 FREQOUT 1,200,0 FREQOUT 1,200,3500 FREQOUT 1,200,0 FREQOUT 1,200,3500 RETURN