From 09921fd086e382e29d97d349cc10cf53d8555f13 Mon Sep 17 00:00:00 2001 From: lanselambor <757016515@qq.com> Date: Wed, 18 Apr 2018 14:44:17 +0800 Subject: [PATCH] add demo for showing incoming call --- .../GPRS_Show_Incoming_Call.ino | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 examples/GPRS_Show_Incoming_Call/GPRS_Show_Incoming_Call.ino diff --git a/examples/GPRS_Show_Incoming_Call/GPRS_Show_Incoming_Call.ino b/examples/GPRS_Show_Incoming_Call/GPRS_Show_Incoming_Call.ino new file mode 100644 index 0000000..b229660 --- /dev/null +++ b/examples/GPRS_Show_Incoming_Call/GPRS_Show_Incoming_Call.ino @@ -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 + +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); +} + +