Olá a todos eu estou com dificuldade de fazer esse shield funcionar ele não consegue fazer a chamada mesmo utilizando a programação correta Alguém poderia me ajudar?
Gostaria de fazer um simples teste de ligação e não consigo.

#include
SoftwareSerial SIM900(7, 8); // Configura el puerto serial para el SIM900

char incoming_char=0; //Variable que guarda los caracteres que envia el SIM900
int salir = 0;
void setup()
{
SIM900.begin(19200); //Configura velocidad serial para el SIM900
delay(25000); //Retardo para que encuentra a una RED
Serial.begin(19200); //Configura velocidad serial para el Arduino
Serial.println("OK"); //Mensaje OK en el arduino, para saber que todo va bien.
}

void llamar()
// Función que permite llamar a un celular local
{
// SIM900.println("ATD 10725275;"); //Numero local
SIM900.println("ATD +55 numero;"); //Celular
delay(100);
SIM900.println();
delay(30000); // wait for 30 seconds...
SIM900.println("ATH"); // Cuelta el telefono
delay(1000);
}
void mensaje_sms()
//Funcion para mandar mensaje de texto
{

SIM900.print("AT+CMGF=1\r"); // AT command to send SMS message
delay(100);
SIM900.println("AT+CMGS=\"+55 numero\""); // recipient's mobile number, in international format
delay(100);
SIM900.println("Eletrokits"); // message to send
delay(100);
SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26 //Comando de finalizacion
delay(100);
SIM900.println();
delay(5000); // Tiempo para que se envie el mensaje
Serial.println("SMS sent successfully");
}

void espera_mensaje()
{
salir = 1;
while(salir==1)
{
if(SIM900.available() >0)
{
incoming_char=SIM900.read(); //Get the character from the celular serial port.
Serial.print(incoming_char); //Print the incoming character to the terminal.
salir = 0;
}
}
}
void modo_recibe_mensaje()
{
//Configura el modo texto para enviar o recibir mensajes
SIM900.print("AT+CMGF=1\r"); // set SMS mode to text
delay(100);
SIM900.print("AT+CNMI=2,2,0,0,0\r");

// blurt out contents of new SMS upon receipt to the GSM shield's serial out
delay(1000);
}
void loop()
{
llamar(); //Llama
mensaje_sms(); //Envia mensaje
modo_recibe_mensaje();
for(;;)
{
if(SIM900.available() >0)
{

incoming_char=SIM900.read(); //Get the character from the celular serial port.
Serial.print(incoming_char); //Print the incoming character to the terminal.
}
if(Serial.available() > 0)
{
if(Serial.read() == 'A') break;
}
}
Serial.println("OK-2");

delay(100);
SIM900.println();
delay(30000);
while(1); // Esperate por tiempo indefinido

}

Exibições: 492

Responder esta

Respostas a este tópico

ola, como vc esta alimentando o shield? quando o shield esta ligando fica piscando um led?

- o shield precisa de 10 volts, se esta alimentando o arduino com 5 volts da saida usb e alimentando o shield pelo arduino, pode ser que nao funcione mesmo

Cara pode parecer idiota, mas eu tive alguns problemas com o meu modulo GSM sim900 e era só apertar um botão POWER do módulo, acha que pode ser isso? Pode enviar uma foto do seu modulo? Eu tenho um código que funciona.

Sim existe este botão,  mas não funcionou desde o inicio. Por favor sim, eu aceito seu código. 

OI, estou aguando o código, obrigado.

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço