i have arduino uno r3, a gsm shield ce0700, and a 4x4 kepad..i got the output for make voicecall..i also connected keypad with arduino and i was getting inputs to the serial moniter..but now i have to connect the gsm shield with the arduino and the keypad to gsm shield so that i can enter the phone num from the keypad and there will be definite keys to call and cut a call on the keypad like 'A','B'...please help me with the code..thanks in advance for reading.. ![]()
i am trying to interface a 4x4 keypad to gsm shield ce0700 and inturn interfacing the gsm to arduino uno r3...so i used both gsm and keypad library..i want to give iputs from keypad such that num and i want to use particular buttons like A,B to call and hang call...but i am getting error on code..
#include <Keypad.h>
// libraries
#include <Keypad.h>
#include <GSM.h>
// PIN Number
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSMVoiceCall vcs;
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS]= {
{'1','2','3','A'},{'4','5','6','B'},{'7','8','9','C'},{'*','0','#','D'}
};
// the number you will call
char charbuffer[20];
String remoteNumber = "";
byte rowPins[ROWS] = {12,11,10,9};
byte colPins[COLS] = {8,7,6,5};
Keypad customKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup()
{
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Make Voice Call");
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("GSM initialized.");
Serial.println("Enter phone number to call.");
}
void loop()
{
// add any incoming characters to the String:
while (Serial.available() > 0)
{
char inChar = Serial.read();
char customKey = customKeypad.getKey();
if( customKey){
Serial.println(customKey);
}
// if it's a newline, that means you should make the call:
if (inChar == '\n')
{
// make sure the phone number is not too long:
if (remoteNumber.length() < 20)
{
// let the user know you're calling:
Serial.print("Calling to : ");
Serial.println(remoteNumber);
Serial.println();
// Call the remote number
remoteNumber.toCharArray(charbuffer, 20);
// Check if the receiving end has picked up the call
if(vcs.voiceCall(charbuffer))
{
Serial.println("Call Established. Enter line to end");
// Wait for some input from the line
while(Serial.read()!='\n' && (vcs.getvoiceCallStatus()==TALKING));
// And hang up
vcs.hangCall();
}
Serial.println("Call Finished");
remoteNumber="";
Serial.println("Enter phone number to call.");
}
else
{
Serial.println("That's too long for a phone number. I'm forgetting it");
remoteNumber = "";
}
}
else
{
// add the latest character to the message to send:
if(inChar!='\r')
remoteNumber += inChar;
}
}
}
while compiling i get this error
In file included from E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\GSM/GSM3MobileNetworkProvider.h:37,
from E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\GSM/GSM3MobileClientService.h:37,
from E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\GSM/GSM.h:42,
from sketch_mar10a.ino:7:
E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\GSM/GSM3MobileAccessProvider.h:37: error: conflicting declaration 'IDLE'
E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\Keypad/utility/Key.h:46: error: 'IDLE' has a previous declaration as 'KeyState IDLE'
gsm_mob.txt (3.43 KB)
E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\GSM/GSM3MobileAccessProvider.h:37: error: conflicting declaration 'IDLE'
E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\Keypad/utility/Key.h:46: error: 'IDLE' has a previous declaration as 'KeyState IDLE'
Looks pretty obvious to me.
Please use code tags when posting code.
please let me know some solution AWOL as i am very new in arduino
Both libraries contain a constant named IDLE and they are conflicting. You can't use those two libraries together unless you resolve the conflict. One way to resolve it would be to edit the source for one of the libraries and change all references to IDLE to some other unique name.
i think the "IDLE" isuue has been resolved..thanks for that..i changed one of the source idle..now i am getting a new error
In file included from sketch_mar10a.ino:1:
E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\Keypad/Keypad.h:97: error: 'KeyState' does not name a type
E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\Keypad/Keypad.h:122: error: 'KeyState' has not been declared
OK thanks for letting us know.
please help me with the code..
// You put some stuff here
void setup()
{
// You put some stuff here
}
void loop()
{
// You put some stuff here
}
You'll need to provide a LOT more details about what YOU have done, and what sketches you have working INDIVIDUALLY in order to get more help.
i apologise for not giving enouh information..this is the code i am using..i have to connect the 4x4 keypad to gsm ce700 and in turn connect the gsm to aurdino..so that i can give inputs like phone num and can use particular keys for hang call and call..
this is the code i am using and i am geting this error
#include <Keypad.h>
// libraries
#include <Keypad.h>
#include <GSM.h>
// PIN Number
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSMVoiceCall vcs;
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS]= {
{'1','2','3','A'},{'4','5','6','B'},{'7','8','9','C'},{'*','0','#','D'}
};
 // the number you will call
char charbuffer[20];
String remoteNumber = "";
byte rowPins[ROWS] = {12,11,10,9};
byte colPins[COLS] = {8,7,6,5};
Keypad customKeypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup()
{
 // initialize serial communications and wait for port to open:
 Serial.begin(9600);
 while (!Serial) {
  ; // wait for serial port to connect. Needed for Leonardo only
 }
 Serial.println("Make Voice Call");
Â
 // connection state
 boolean notConnected = true;
Â
 // Start GSM shield
 // If your SIM has PIN, pass it as a parameter of begin() in quotes
 while(notConnected)
 {
  if(gsmAccess.begin(PINNUMBER)==GSM_READY)
   notConnected = false;
  else
  {
   Serial.println("Not connected");
   delay(1000);
  }
 }
Â
 Serial.println("GSM initialized.");
 Serial.println("Enter phone number to call.");
}
void loop()
{
 // add any incoming characters to the String:
 while (Serial.available() > 0)
 {
  char inChar = Serial.read();
  char customKey = customKeypad.getKey();
  if( customKey){
   Serial.println(customKey);
  }
  // if it's a newline, that means you should make the call:
  if (inChar == '\n')
  {
   // make sure the phone number is not too long:
   if (remoteNumber.length() < 20)
   {
    // let the user know you're calling:
    Serial.print("Calling to : ");
    Serial.println(remoteNumber);
    Serial.println();
    // Call the remote number
    remoteNumber.toCharArray(charbuffer, 20);
   Â
   Â
    // Check if the receiving end has picked up the call
    if(vcs.voiceCall(charbuffer))
    {
     Serial.println("Call Established. Enter line to end");
     // Wait for some input from the line
     while(Serial.read()!='\n' && (vcs.getvoiceCallStatus()==TALKING));    Â
     // And hang up
     vcs.hangCall();
    }
    Serial.println("Call Finished");
    remoteNumber="";
    Serial.println("Enter phone number to call.");
   }
   else
   {
    Serial.println("That's too long for a phone number. I'm forgetting it");
    remoteNumber = "";
   }
  }
  else
  {
   // add the latest character to the message to send:
   if(inChar!='\r')
    remoteNumber += inChar;
  }
 }
}
and this is the error
In file included from E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\GSM/GSM3MobileNetworkProvider.h:37,
        from E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\GSM/GSM3MobileClientService.h:37,
        from E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\GSM/GSM.h:42,
        from sketch_mar10a.ino:7:
E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\GSM/GSM3MobileAccessProvider.h:37: error: conflicting declaration 'IDLE'
E:\Trinanjan\software\arduino idk\arduino-1.0.5\libraries\Keypad/utility/Key.h:46: error: 'IDLE' has a previous declaration as 'KeyState IDLE'