Arduino with Adafruit FONA SIM800H

Am using arduino mega with adafruit fona 800h and it is working great with serial,but i want to use keypad 4*4 to dial a number and when i hit C the call goes can anyone help me?

can anyone help me?

With what? If you know which pins on the keypad are row pins and which are column pins, using the keypad library to get which key is actually pressed is trivial.

Storing the keys in an array, as you discover that they are pressed, is pretty easy. Detecting that the key that was pressed is a 'C', so that, instead of storing it in the array, you use the data in the array, is dirt simple.

#include <Adafruit_FONA.h>
#include <Keypad.h>
#include <SoftwareSerial.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {
{‘1’,‘2’,‘3’,‘A’},
{‘4’,‘5’,‘6’,‘B’},
{‘7’,‘8’,‘9’,‘C’},
{’*’,‘0’,’#’,‘D’}
};

byte rowPins[ROWS] = {50, 51, 48, 49}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {46, 47, 44, 45}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

#define FONA_RX 2
#define FONA_TX 10
#define FONA_RST 4
// this is a large buffer for replies
char replybuffer[255];
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);
uint8_t type;

String keypadString ;
char TelephoneNumberToCall[14];
int callStatus = 0;
int TempNumTwo = 0;
int beeps =0;
int freq = 500;

void setup(){
while (!Serial);

Serial.begin(115200);
Serial.println(F(“FONA basic test”));
Serial.println(F(“Initializing…(May take 3 seconds)”));

fonaSerial->begin(4800);
if (! fona.begin(*fonaSerial)) {
Serial.println(F(“Couldn’t find FONA”));
while (1);
}
}

void loop(){
Serial.print(F("FONA> "));
while (! Serial.available() ) {
if (fona.available()) {
Serial.write(fona.read());
}
}

char key = keypad.getKey();
if (key == ‘A’ || key ==‘B’ || key ==‘C’ ||key ==‘D’){
if(key == ‘A’){
if (! fona.pickUp()) {
Serial.println(F(“Failed”));
} else {
Serial.println(F(“OK!”));
}}
if(key == ‘C’){

Serial.println();
Serial.print(F("Calling ")); Serial.println(TelephoneNumberToCall);
if (!fona.callPhone(TelephoneNumberToCall)) {

Serial.print(“CALL FAILED!”);
} else {

Serial.print(“CALL SENT!”);
}
}
}
else {while (callStatus<1){
TypeAnumberIn(); // Get the telephone number from the keypad.
int TempNumOne=sizeof(keypadString);
for (int aa=0;aa<=TempNumTwo;aa++) // Builds the tel. number
{
TelephoneNumberToCall[aa]=keypadString[aa];
}
flushSerial();
}

}

}
void flushSerial() {
while (Serial.available())
Serial.read();
}
void CallStatus() { // get call status

delay (500);
int8_t callstat = fona.getCallStatus();

if ((callstat >2) && (callstat <4)){
beeps = 0;
freq = 0;
while(beeps < 5){
beeps++;
freq = freq + 100;
tone(7, freq, 50);
delay (50);
}
delay (2000);
}

}
void TypeAnumberIn(){
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// This is where the keypad strokes are turned into a FONA compatible character:

CallStatus(); // This tells us if someone is calling us etc.
char key = keypad.getKey();
if (key != NO_KEY)
{
// Converts char ‘key’ into string and adds it to ‘keypadString’.
keypadString = keypadString + String (key);
tone(7, (key-30) * 50, 500); // plays a tone on keypad press
TempNumTwo = TempNumTwo + 1; // size of string
char TelephoneNumberToCall[14]; // Converts back to a character for Fona when ‘select’ button is pressed.
if (key){
Serial.println(key);
}
} }

this code i used but it doesn't worked i have used the fonatest code http://textuploader.com/dqtgj! and it is worked good