Projeto Arduino
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Enviar SMS e receber confirmação de comando efetuado

Ir para baixo

Enviar SMS e receber confirmação de comando efetuado Empty Enviar SMS e receber confirmação de comando efetuado

Mensagem  Alencar Dom 8 Set - 16:35

Boa noite!

Estou realizando um projeto onde uso o arduino duemilanove e o shield sim900d.A minha intenção é receber um sms pelo arduino, após ele receber acionar um led e enviar um sms ao número que mandou o sms com a informação de que o led foi aceso.

Eu já consegui receber o sms, mas não sei acrescentar no código a informação para ele acionar o led e enviar o sms de volta.

Se alguém puder me ajudar vou ficar muito agradecido. Abaixo o código que estou usando:

#include

// PIN Number for the SIM
#define PINNUMBER ""

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

// Array to hold the number a SMS is retreived from
char senderNumber[20];
int powerkey = 5;
int statuspin = 6;
int pinState = 0;
String inputString = ""; // a string to hold incoming data
boolean stringComplete = false; // whether the string is complete
char inChar;


void setup()
{
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect.
pinMode(powerkey, OUTPUT);
pinMode(statuspin, INPUT);
inputString.reserve(200);
} delay(100);

Serial.println("Serial conectada");

// connection state
boolean notConnected = true;

// Start GSM connection
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Nao conectado");
delay(1000);
}
}

Serial.println("GSM inicializado");
Serial.println("Aguardando novas mensagens");
}

void loop()
{
char c;

// If there are any SMSs available()
if (sms.available())
{
Serial.println("Mensagem recebida de:");

// Get remote number
sms.remoteNumber(senderNumber, 20);
Serial.println(senderNumber);

// An example of message disposal
// Any messages starting with * should be discarded
if(sms.peek()=='*')
{
Serial.println("SMS Descartada");
sms.flush();
}

// Read message bytes and print them
while(c=sms.read())
Serial.print(c);

Serial.println("\nFim da Mensagem");

// Delete message from modem memory
sms.flush();
Serial.println("MENSAGEM APAGADA");
}

delay(1000);

}

Abraços

Alencar

Alencar

Mensagens : 2
Data de inscrição : 08/09/2013

Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos