Go Down

Topic: Arduino Uno + Telefonica GSM Shield + Interrupt (PinChangeInt ?) (Read 872 times) previous topic - next topic

simon_schvartzman

Hi, I'm working on a project where I'm using an Arduino UNO + Telefonica GSM shield and need to use at least one interrupt but since the GSM shield uses Pin2 & 3 there is no interrupt left for me to use.

It seems PinChangeInt library is the solution but I´m not able to figure out how to use it.

Adding both libraries as follows

//GSM VARIABLES
// libraries
#include <GSM.h>
#include <PinChangeInt.h>

generates the following compile errors

Quote

GSM/GSM3SoftSerial.cpp.o: In function `__vector_5':
/Applications/Arduino.app/Contents/Resources/Java/libraries/GSM/src/GSM3SoftSerial.cpp:525: multiple definition of `__vector_5'
W2S_GSM_V1.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/PinChangeInt/PinChangeInt.h:585: first defined here
GSM/GSM3SoftSerial.cpp.o: In function `__vector_4':
/Applications/Arduino.app/Contents/Resources/Java/libraries/GSM/src/GSM3SoftSerial.cpp:518: multiple definition of `__vector_4'
W2S_GSM_V1.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/PinChangeInt/PinChangeInt.h:575: first defined here
GSM/GSM3SoftSerial.cpp.o: In function `__vector_3':
/Applications/Arduino.app/Contents/Resources/Java/libraries/GSM/src/GSM3SoftSerial.cpp:511: multiple definition of `__vector_3'
W2S_GSM_V1.cpp.o:/Applications/Arduino.app/Contents/Resources/Java/libraries/PinChangeInt/PinChangeInt.h:565: first defined here


What am I doing wrong?

Many thanks in advance

jhoneduardo12

I'm new to the subject, I recently bought a Arduino GSM Shield, I'm doing the arduino examples provided. I made the code as it is written like this there. and when I try to type the phone number for the serial port does nothing more, I need your help to see if there is an error in the code. Thank you.


link: http://arduino.cc/en/Reference/GSMSMSEndSMS?action=sourceblock&num=1

#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSM_SMS sms;

void setup()
{
  // initialize serial communications
  Serial.begin(9600);

  Serial.println("SMS Messages Sender");

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

void loop()
{

  Serial.print("Enter a mobile number: ");
  char remoteNumber[20];  // telephone number to send sms
  readSerial(remoteNumber);
  Serial.println(remoteNumber);

  // sms text
  Serial.print("Now, enter SMS content: ");
  char txtMsg[200];
  readSerial(txtMsg);
  Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
  Serial.println(txtMsg);

  // send the message
  sms.beginSMS(remoteNumber);
  sms.print(txtMsg);
  sms.endSMS();
  Serial.println("\nCOMPLETE!\n");
}

/*
  Read input serial
*/
int readSerial(char result[])
{
  int i = 0;
  while(1)
  {
    while (Serial.available() > 0)
    {
      char inChar = Serial.read();
      if (inChar == '\n')
      {
        result = '\0';
        Serial.flush();
        return 0;
      }
      if(inChar!='\r')
      {
        result = inChar;
        i++;
      }
    }
  }
}

simon_schvartzman

Nothing seems to be wrong with your code, as it is exactly the same provided by the SendSMS example .

Two questions:
1 - In which Arduino board are you loading it?
2 -Do you get any message at all on the Serial Monitor?

Best!

Go Up