Sketch: Fona->Incoming Call
I successfully use the Sketch: FonaTest to verify the hardware.
When I run the Incoming Call sketch, the board rings properly but the following code never prints out "RING!".
Code: Select all
// Check for an incoming call. Will return true if a call is incoming.
if(fona.incomingCallNumber(phone)){
Serial.println(F("RING!"));
Serial.print(F("Phone Number: "));
Serial.println(phone);
}
I tried both these lines to see if the interrupt is set correctly.
Code: Select all
// #define FONA_RI_INTERRUPT 7 //per docs for FeatherFONA
uint8_t FONA_RI_INTERRUPT =7; //per docs for FeatherFONA
Here is the output of the sketch.
Code: Select all
<---
---> AT
<---
---> AT
<--- AT
---> AT
<--- AT
---> ATE0
<--- ATE0
---> ATE0
<--- OK
---> AT+CVHU=0
<--- OK
---> ATI
<--- SIM800 R13.08
OK
RDY
+CFUN: 1
---> AT+GMM
<--- SIMCOM_SIM800H
OK
+CPIN: READY
---> AT+CPMS="SM","SM","SM"
<--- ERROR
FONA is OK
---> AT+CHFA=1
<--- OK
External Audio setup
---> AT+CMIC=1,15
<--- OK
---> AT+CLVL=75
<--- OK
Speaker Volume set to 75
---> AT+CLIP=1
<--- OK
Caller id notification enabled.
Code: Select all
/ FONA Incoming Call Number Example
// Listens for a call and displays the phone number of the caller (if available).
// Use this example to add phone call detection to your own FONA sketch.
#include "Adafruit_FONA.h"
// #include "includes/FONAConfig.h"
// Pins which are connected to the FONA.
// Note that this is different from FONAtest!
#define FONA_RX 9
#define FONA_TX 8
#define FONA_RST 4
// Note you need to map interrupt number to pin number
// for your board. On an Uno & Mega interrupt 0 is
// digital pin 2, and on a Leonardo interrupt 0 is
// digital pin 3. See this page for a complete table:
// http://arduino.cc/en/Reference/attachInterrupt
// Make sure this interrupt pin is connected to FONA RI!
// #define FONA_RI_INTERRUPT 7 //per docs for FeatherFONA
uint8_t FONA_RI_INTERRUPT =7; //per docs for FeatherFONA
// We default to using software serial. If you want to use hardware serial
// (because softserial isnt supported) comment out the following three lines
// and uncomment the HardwareSerial line
#include <SoftwareSerial.h>
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
// Hardware serial is also possible!
// HardwareSerial *fonaSerial = &Serial1;
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
void setup() {
pinMode(FONA_RI_INTERRUPT, INPUT);
Serial.begin(115200);
delay(5);
#ifdef ADAFRUIT_FONA_DEBUG
DEBUG_PRINTLN(F("Debug printing enabled"));
#endif
Serial.println(F("FONA incoming call example"));
Serial.println(F("Initializing....(May take 3 seconds)"));
fonaSerial->begin(4800);
if (! fona.begin(*fonaSerial)) {
Serial.println(F("Couldn't find FONA"));
while(1);
}
Serial.println(F("FONA is OK"));
// Set External output
if (! fona.setAudio(FONA_EXTAUDIO)) {
Serial.println(F("Output Setting Failed"));
} else {
Serial.println(F("External Audio setup"));
}
fona.setMicVolume(FONA_EXTAUDIO, 15);
//Set Speaker Volume
if (! fona.setVolume(75)) {
Serial.println(F("Speaker Volume setting Failed"));
} else {
Serial.println(F("Speaker Volume set to 75"));
}
// Enable incoming call notification.
if(fona.callerIdNotification(true, FONA_RI_INTERRUPT)) {
Serial.println(F("Caller id notification enabled."));
}
else {
Serial.println(F("Caller id notification disabled"));
}
}
void loop(){
// Create a small string buffer to hold incoming call number.
char phone[32] = {0};
// Check for an incoming call. Will return true if a call is incoming.
if(fona.incomingCallNumber(phone)){
Serial.println(F("RING!"));
Serial.print(F("Phone Number: "));
Serial.println(phone);
}
/*
while (fona.available()) {
Serial.write(fona.read());
}
*/
}