0

fona 808 shield only recognize first call
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

fona 808 shield only recognize first call

by cuevas957 on Sat Aug 24, 2019 4:58 pm

need help.
im using
fona 808 shield
arduino uno
lypo battery

using the example code "IncomingCall.ino" only change the connection pins
from
#define FONA_RX 3
#define FONA_TX 4
#define FONA_RST 5
to
#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4

Im not sure, but I could swear that uses to recognize several calls, but now, only recognize the first time I call the number, then nothing else happens when I call.

i was working with fona library, I replace whith the original library and doesn't make any other changes in IncomingCalls.ino

Help me pease, don't know If I have to make some kind of reset to the shield or some thing like that.

thanks
IncomingCall.ino
Code: Select all | TOGGLE FULL SIZE
// 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"

// Pins which are connected to the FONA.
// Note that this is different from FONAtest!
#define FONA_RX            2
#define FONA_TX            3
#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  0

// 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() {
  Serial.begin(115200);
  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"));

  // 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);
  }
}

cuevas957
 
Posts: 6
Joined: Thu Aug 22, 2019 3:13 am

Re: fona 808 shield only recognize first call

by adafruit_support_mike on Sun Aug 25, 2019 12:28 pm

Try using the ‘fonatest’ sketch that comes with the FONA library. Does that work the way it should?

adafruit_support_mike
 
Posts: 58856
Joined: Thu Feb 11, 2010 2:51 pm

Re: fona 808 shield only recognize first call

by cuevas957 on Sun Aug 25, 2019 2:11 pm

first off all. thanks for your reply.

And yes, the fonatest code works fine, but its different
- incomingcall.ino works with interruption
- fonatest.ino dont, in fonatest.ino just print from fona incoming
Code: Select all | TOGGLE FULL SIZE
while (fona.available()) {
      Serial.write(fona.read());
    }

i have being trying with the fonatest code to detect a call and parse the telephone number when a call is detected, but I can't make it work.

when I have a call in fonatest.ino the serial monitor bring that:

/////////////SERIAL MONITOR/////////////////
RING

+CLIP: "656969585",161,"",0,"",0
//////////////////////////////////////////////////////////

cuevas957
 
Posts: 6
Joined: Thu Aug 22, 2019 3:13 am

Re: fona 808 shield only recognize first call

by cuevas957 on Sun Aug 25, 2019 3:24 pm

SOLVED!!
post the code if anybody need it or someone know how to optimize or another better way to do the same

Code: Select all | TOGGLE FULL SIZE

String s;

void setup()
{
s.reserve(100);
}

void loop()
{
  char c;
  int i = 0;

  while (fona.available()) {
    c = fona.read();
    Serial.write(c);

    if (c != 0xA)
    {
      s += c;
    }
    else
    {
      if (s.indexOf("RING") != -1)
      {
        Serial.println("INCOMING CALL");
        fona.hangUp();
      }
      s = "";
    }
  }
}


cuevas957
 
Posts: 6
Joined: Thu Aug 22, 2019 3:13 am

Re: fona 808 shield only recognize first call

by adafruit_support_mike on Wed Aug 28, 2019 12:08 am

Glad to hear you got things working. Happy hacking!

adafruit_support_mike
 
Posts: 58856
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.