Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
add demo for showing incoming call
Browse files Browse the repository at this point in the history
  • Loading branch information
lanselambor committed Apr 18, 2018
1 parent bf5c26a commit 09921fd
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions examples/GPRS_Show_Incoming_Call/GPRS_Show_Incoming_Call.ino
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);
}


0 comments on commit 09921fd

Please sign in to comment.