This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf5c26a
commit 09921fd
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
examples/GPRS_Show_Incoming_Call/GPRS_Show_Incoming_Call.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
SIM900 Serial Debug | ||
This sketch is used to communicate with SIM900 with AT commands. | ||
create on 2015/05/14, version: 1.0 | ||
by lawliet.zou(lawliet.zou@gmail.com) | ||
*/ | ||
#include "GPRS_Shield_Arduino.h" | ||
#include <Wire.h> | ||
|
||
const int PIN_TX = 7; | ||
const int PIN_RX = 8; | ||
const int BAUDRATE = 9600; | ||
|
||
GPRS gprs(PIN_TX,PIN_RX,BAUDRATE);//RX,TX,PWR,BaudRate | ||
char in_number[16] = {0}; | ||
|
||
void setup(){ | ||
gprs.checkPowerUp(); | ||
Serial.begin(9600); | ||
} | ||
|
||
void loop(){ | ||
// gprs.AT_Bypass(); | ||
|
||
/** | ||
* Result code: | ||
* 0: ready | ||
* 2: unknown | ||
* 3: ringing | ||
* 4: call in progress | ||
*/ | ||
bool is_active; | ||
char in_number[16] = {0}; | ||
|
||
is_active = gprs.isCallActive(in_number); | ||
|
||
Serial.print("Active code : "); | ||
Serial.println(is_active); | ||
if(is_active) { | ||
Serial.print("Phone call in: "); | ||
Serial.println(in_number); | ||
} else { | ||
Serial.println("No phone call in."); | ||
} | ||
|
||
delay(1000); | ||
} | ||
|
||
|