1

I want to receive SMS and check whether the character is 'y' or 'n'. If it is 'y', set a pin to high so that a light glows. I thought I could use the example code given in the Arduino IDE for receiving SMS, but when I compile (without connecting the board, using ctrl+r) it shows the following errors:

Arduino: 1.8.1 (Windows 7), Board: "Arduino/Genuino Uno"

In file included from F:\Arduino\libraries\GSM\src/GSM.h:46:0,
                 from F:\Arduino\libraries\GSM\examples\ReceiveSMS\ReceiveSMS.ino:21:
F:\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration
 typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};
                                                                                                                             ^
F:\Arduino\libraries\GSM\examples\ReceiveSMS\ReceiveSMS.ino: In function 'void setup()':
F:\Arduino\libraries\GSM\examples\ReceiveSMS\ReceiveSMS.ino:47:34: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
     if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
                                  ^
Sketch uses 13322 bytes (41%) of program storage space. Maximum is 32256 bytes.
Global variables use 996 bytes (48%) of dynamic memory, leaving 1052 bytes for local variables. Maximum is 2048 bytes.
An error occurred while uploading the sketch
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Please help me rectify the error.

I use a SIM900 GSM board. I connect the tx and rx of the GSM board to the Arduino's tx and rx.

2

Those are warnings, not errors. The code should have compiled and be able to flash.

  • thanks a lot man ... it means a lot to me. i am new to arduino. i will flash it and will let you know :) thanks for your help – Mr.AG Mar 12 '17 at 14:25
1

Yes they are just warning, but don't assume all warnings should be ignored. In this case they can be ignored, but you may as well fix them to stop them cluttering the output.

The first one can be fixed by removing the word typedef.

The second one needs you to add .c_str() on the end of the string variable. Sometimes 'string' classes don't store the data in the same way as a char array.

  • tx and rx of arduino are connected to the rx and tx of gsm board. ground is also connected. is the problem with the code or the connections? – Mr.AG Mar 14 '17 at 16:06
  • I modified the example according to my needs. so when i send 'y' to the gsm , i hear that beep sound indicating that message has been received. But there is no reaction from the arduino. The modified code snippet is as follows: if (sms.peek() == '#') { Serial.println("Discarded SMS"); sms.flush(); } // Read message bytes and print them while (c = sms.read()) { Serial.print(c); if(c=='y'){ digitalWrite(LED_BUILTIN,HIGH); } else digitalWrite(LED_BUILTIN,LOW); } – Mr.AG Mar 14 '17 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.