Go Down

Topic: Send Special Characters Via SMS (Read 1 time) previous topic - next topic

jsukup

I was wondering if it is possible to send characters such as { and } using the Arduino GSM shield library?  I have looked online to see if this is possible and have come up with nothing.  If it is possible, how do you send the extended character.  Is it sent as  hex value which would be 0x1B, 0x28 for the { character?  Any help or guidance would be appreciated.

Thank You

davidgoth

Hi, you can send whatever ASCII character with:

Code: [Select]

#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;

char txt[8] = {'{', 'H', 'e', 'l', 'l', 'o', '}', 0}; // TXT: {Hello}\0

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
  }
 
  // 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()
{
    // send the message
  sms.beginSMS("+34123456789"); // Telephone Number
  sms.print(txt); // Content
  sms.endSMS();
  Serial.println("\nCOMPLETE!\n");
}


shanevanj

AFAIK, SMS only send 7 bits (bit 8 reserved for special functions) so you would have to encode the special chr to be 7bit ascii - use UUENCODE or similar and decode on the other side...


Go Up