File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import time
2+ import board
3+ import busio
4+ import digitalio
5+ from adafruit_fona .adafruit_fona import FONA
6+
7+ print ("FONA SMS" )
8+
9+ # Create a serial connection for the FONA connection
10+ uart = busio .UART (board .TX , board .RX )
11+ rst = digitalio .DigitalInOut (board .D4 )
12+
13+ # Initialize FONA module (this may take a few seconds)
14+ fona = FONA (uart , rst , debug = False )
15+
16+ # Initialize Network
17+ while fona .network_status != 1 :
18+ print ("Connecting to network..." )
19+ time .sleep (1 )
20+ print ("Connected to network!" )
21+ print ("RSSI: %ddB" % fona .rssi )
22+
23+ # Text a number
24+ if not fona .send_sms (140404 , "HELP" ):
25+ raise RuntimeError ("FONA did not successfully send SMS" )
26+
27+ # Ask the FONA how many SMS message it has
28+ num_sms = fona .num_sms
29+ print ("%d SMS's on SIM Card" % num_sms )
30+
31+ # Read out all the SMS messages on the FONA's SIM
32+ for slot in range (1 , num_sms ):
33+ print (fona .read_sms (slot ))
You can’t perform that action at this time.
0 commit comments