-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathM590_UNO_sms_sender_3buttons_ver1m0.ino
99 lines (82 loc) · 2.37 KB
/
M590_UNO_sms_sender_3buttons_ver1m0.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// http://letsplaywitharduino.blogspot.in/p/gsm-modem-with-arduino-uno.html
// adapted sketch by niq_ro from http://www.tehnic.go.ro
// http://arduinotehniq.blogspot.com/
// sms sender with 3 buttons with M590 GPRS module
void setup()
{
Serial.begin(115200); //Baud rate of the GSM/GPRS Module
pinMode(2, INPUT); // send button is put at D2
digitalWrite(A0, HIGH); // pull-up the input
pinMode(3, INPUT); // send button is put at D3
digitalWrite(A0, HIGH); // pull-up the input
pinMode(4, INPUT); // send button is put at D4
digitalWrite(A0, HIGH); // pull-up the input
pinMode(13, OUTPUT); // D13 is output pin
}
void loop()
{
if (digitalRead(2) == LOW) // if 1st button is push
{
digitalWrite(13, HIGH); // led from D13 is on
trimitere();
digitalWrite(13, LOW); // led from D13 is off
}
if (digitalRead(3) == LOW) // if 2nd button is push
{
digitalWrite(13, HIGH); // led from D13 is on
trimitere2();
digitalWrite(13, LOW); // led from D13 is off
}
if (digitalRead(2) == LOW) // if 3rd button is push
{
digitalWrite(13, HIGH); // led from D13 is on
trimitere3();
digitalWrite(13, LOW); // led from D13 is off
}
delay(100);
}
void trimitere()
{
Serial.print("\r");
delay(1000);
Serial.print("AT+CSCS=\"GSM\"\r");
delay(1000);
Serial.print("AT+CMGF=1\r");
delay(1000);
Serial.print("AT+CMGS=\"+407xxxxxxxx\"\r"); //Number to which you want to send the sms
delay(1000);
Serial.print("Test1 by niq_ro\r"); //The text of the message to be sent
delay(1000);
Serial.write(0x1A);
delay(1000);
}
void trimitere2()
{
Serial.print("\r");
delay(1000);
Serial.print("AT+CSCS=\"GSM\"\r");
delay(1000);
Serial.print("AT+CMGF=1\r");
delay(1000);
Serial.print("AT+CMGS=\"+407xxxxxxxx\"\r"); //Number to which you want to send the sms
delay(1000);
Serial.print("Test2 by niq_ro\r"); //The text of the message to be sent
delay(1000);
Serial.write(0x1A);
delay(1000);
}
void trimitere3()
{
Serial.print("\r");
delay(1000);
Serial.print("AT+CSCS=\"GSM\"\r");
delay(1000);
Serial.print("AT+CMGF=1\r");
delay(1000);
Serial.print("AT+CMGS=\"+407xxxxxxxx\"\r"); //Number to which you want to send the sms
delay(1000);
Serial.print("Test3 by niq_ro\r"); //The text of the message to be sent
delay(1000);
Serial.write(0x1A);
delay(1000);
}