Skip to content

Latest commit

 

History

History
86 lines (63 loc) · 1.85 KB

GSM_Sample.md

File metadata and controls

86 lines (63 loc) · 1.85 KB
layout title permalink
code
GSM Shield
/GSM Shield.htm

SeedStudio GSM shield

Learn how to use the SeedStudio GSM shield

{:width="400"}

Required Components

Shield setup

  • Move the two switches to the rigth (Serial port select as indicates in the image) to select the hardware serial {:width="400"}

Create a new project

  1. Create a new project from the template.
  2. Replace the existing code in main.cpp with the following code:
  3. Add to the project the files GSM.cpp, HWSerial.cpp, SIM900.cpp and sms.cpp found in GSM Library

Code

Main.cpp

{% highlight C++ %} // Main.cpp : Defines the entry point for the console application. // // Sample application for sending SMS using GSM library - dacol 07/2014 //

#include "stdafx.h"
#include "arduino.h"
#include "SIM900.h"
#include "sms.h"

SMSGSM sms;

// Helper function for logging to debug output and the console
void CustomLogging(char* str)
{
	OutputDebugStringA(str); // for VS Output
	printf(str); // for commandline output
}

int _tmain(int argc, _TCHAR* argv[])
{
	return RunArduinoSketch();
}

void setup()
{
	CustomLogging("Init GSM module.\n");
	gsm.begin(19200);
}

void loop()
{
	// Add your phone number
	char phoneNumber[] = { "+49151123456" };
	char smstext[] = { "Hi, This message was sent to you By Galileo" };
	int smsCounter = 0;
	int maxSMSSent = 1;

	CustomLogging("Sending sms.\n");

	if (smsCounter < maxSMSSent)
	{
		sms.SendSMS(phoneNumber, smstext);
		smsCounter++;
	}

	CustomLogging("sms sent.\n");
}

{% endhighlight %}


« Return to Samples{:role="button"}{:class="btn btn-default"}