Skip to content

Commit 2a32c3e

Browse files
author
brentru
committed
add autoreply and delete the msg!
1 parent 58df7a6 commit 2a32c3e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

examples/fona_sms_response.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
rst = digitalio.DigitalInOut(board.D5)
1212

1313
# Initialize FONA module (this may take a few seconds)
14-
fona = FONA(uart, rst)
15-
16-
# Enable FONA debug output
17-
fona.debug=True
14+
fona = FONA(uart, rst, debug=True)
1815

1916
# Initialize Network
2017
while fona.network_status != 1:
@@ -43,3 +40,14 @@
4340
sender, message = fona.read_sms(sms_slot)
4441
print("FROM: ", sender)
4542
print("MSG: ", message)
43+
44+
# Reply back!
45+
print("Sending response...")
46+
if not fona.send_sms(int(sender), "Hey, I got your text!"):
47+
print("SMS Send Failed")
48+
print("SMS Sent!")
49+
50+
# Delete the original message
51+
if not fona.delete_sms(sms_slot):
52+
print("Could not delete SMS in slot", sms_slot)
53+
print("OK!")

0 commit comments

Comments
 (0)