Boa noite pessoal,
Estou com dificuldade para enviar um sms utilizando o shield gsm IcomSat 1.1 SIM900, no Arduino mega 2560.
Através do monitoramento da porta serial percebo que a msg retornada é a seguinte:
ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp
Meu código está da seguinte forma:
#include <SIM900.h>
#include <SoftwareSerial.h>
//Carrega a biblioteca SMS
#include <sms.h>
SMSGSM sms;
int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];
//sim900(4, 3);
void setup()
{
//Inicializa a serial
Serial.begin(9600);
Serial.println("Testando GSM shield...");
//Inicia a configuracao do Shield
if (gsm.begin(2400))
{
Serial.println("SIM900 PRONTO...");
Serial.println("\nstatus=READY");
started=true;
}
else Serial.println("\nstatus=IDLE");
if(started)
{
//Envia um SMS para o numero selecionado
//Formato sms.SendSMS(<numero>,<mensagem>)
if (sms.SendSMS("04796622071", "Arduino MEGA 2560,SMS"))
Serial.println("\nSMS sent OK");
}
}
void loop()
{
if(started)
{
//Aguarda SMS e mostra o texto no serial monitor
if(gsm.readSMS(smsbuffer, 160, n, 20))
{
Serial.println(n);
Serial.println(smsbuffer);
delay(5000);
}
delay(1000);
}
}
E o código do Cpp fui olhar e está da seguinte forma:
....
/*
This is a Beta version.
last modified 18/08/2012.
This library is based on one developed by Arduino Labs
and it is modified to preserve the compability
with the Arduino's product.
The library is modified to use the GSM Shield,
developed by www.open-electronics.org
(http://www.open-electronics.org/arduino-gsm-shield/)
and based on SIM900 chip,
with the same commands of Arduino Shield,
based on QuectelM10 chip.
*/
#include "GSM.h"
#include "WideTextFinder.h"
//De-comment this two lines below if you have the
//first version of GSM GPRS Shield
//#define _GSM_TXPIN_ 4
//#define _GSM_RXPIN_ 5
//De-comment this two lines below if you have the
//second version og GSM GPRS Shield
#define _GSM_TXPIN_ 3
#define _GSM_RXPIN_ 4
//#define _GSM_TXPIN_ 0
//#define _GSM_RXPIN_ 1
#ifdef UNO
GSM::GSM():_cell(_GSM_TXPIN_,_GSM_RXPIN_),_tf(_cell, 10),_status(IDLE)
{
};
#endif
#ifdef MEGA
GSM::GSM()
{
_cell.begin(9600);
};
#endif
OBS: Copiei só a parte que traz a definição das portas
Já tentei diversas configurações e ainda não consegui obter sucesso.
Abaixo segue as imagens do conjunto Arduino + shield
Tags:
Pois é cara eu achei bem mais simples assim
acabei de testar e funcionou legal
abraço!
Boa noite pessoal,
Obrigado pelo auxílio!
Hoje estou demasiadamente cansado e já são 01 da madruga.
Mas amanhã ao chegar em casa vou recomeçar a brincadeira :)
Um grande abraço e obrigado pelas informações extremamente didáticas.
Bom descanso a todos.
Bem-vindo a
Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)
© 2024 Criado por Marcelo Rodrigues. Ativado por