-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathGSMContacts.ino
54 lines (47 loc) · 1.14 KB
/
GSMContacts.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
This uses an MKR GSM 1400 to access the FLASH memory on the sim card that contains contact information.
Circuit:
* MKR GSM 1400 board
* SIM card
created 18 Sept 2019
by Joshua Klein
*/
#include <MKRGSM.h>
GSMContacts contacts;
void setup() {
delay(5); //give hardware time to settle
Serial.begin(9600);
while(!Serial);
Serial.println("starting modem...");
contacts.begin();
//Serial.println("ready");
}
void loop(){
if(contacts.ready()) {
char * i;
Contact c;
i = contacts.search("");
if(i[0] == 0) {
Serial.println("search returned zero results");
/* loop indefinitely */
while(true);
}
Serial.print("search returned ");
Serial.print(strlen(i));
Serial.println(" results");
while(*i != 0) {
Serial.println((byte)(*i),DEC);
contacts.get(c,*i);
Serial.print(" num:");
Serial.println(c.Number);
Serial.print(" type:");
Serial.println(c.Type);
Serial.print(" name:");
Serial.println(c.Name);
i++;
}
/* loop indefinitely */
while(true);
}
delay(10000);
}