SIM908 parou de responder no Terminal
Página 1 de 1
SIM908 parou de responder no Terminal
Amigos, tenho um modulo SIM908 e ele parou de responder
Estou utilizando o codigo abaixo, e funcionava certinho... mas derepente nao retorna mais nda no numero_bytes = mySerial.available();
alguma ideia?
#include
NewSoftSerial mySerial(2, 3);
#define BUF_LEN 200
int powerkey = 5;
int statuspin = 6;
int pinState = 0;
byte numero_bytes;
byte retorno;
int verifica = 0;
char codigoNMEA[BUF_LEN];
byte n;
void setup(){
pinMode(powerkey, OUTPUT);
pinMode(statuspin, INPUT);
mySerial.begin(9600);
Serial.begin(9600);
}
void loop(){
pinState = digitalRead(statuspin);
if(pinState==LOW){
digitalWrite(powerkey, HIGH);
delay(2000);
digitalWrite(powerkey, LOW);
}
if (verifica == 0) {
mySerial.println("AT+CGPSPWR=0"); // Desliga o modulo
delay(1000);
mySerial.println("AT+CGPSPWR=1"); // Liga o modulo GPS
Serial.println("Ligando modulo...");
delay(1000);
mySerial.println("AT+CGPSRST=0"); // Reseta GPS
Serial.println("Resetando GPS..");
delay(1000);
verifica = 1;
mySerial.flush();
}
limpa_buffer();
mySerial.flush();
delay(500);
mySerial.println("AT+CGPSINF=32"); // Solicita codigo NMEA
delay(1000);
numero_bytes = mySerial.available(); //Pega quantidade de bytes que estao na serial
while (mySerial.available() > 0) //Espera até que serial possua bytes
{
for(n=0; n {
codigoNMEA[n] = mySerial.read();
}
}
if (n == 63) {
//Se o n for menor que 63 descarta pacote
//Alimenta as variaveis com o conteudo do buffer
Serial.print("Codigo NMEA: ");
Serial.println(codigoNMEA);
}
mySerial.flush(); //limpa buffer de entrada da serial
limpa_buffer();
}
void limpa_buffer()
{
memset(codigoNMEA,'\0',BUF_LEN);
}
Estou utilizando o codigo abaixo, e funcionava certinho... mas derepente nao retorna mais nda no numero_bytes = mySerial.available();
alguma ideia?
#include
NewSoftSerial mySerial(2, 3);
#define BUF_LEN 200
int powerkey = 5;
int statuspin = 6;
int pinState = 0;
byte numero_bytes;
byte retorno;
int verifica = 0;
char codigoNMEA[BUF_LEN];
byte n;
void setup(){
pinMode(powerkey, OUTPUT);
pinMode(statuspin, INPUT);
mySerial.begin(9600);
Serial.begin(9600);
}
void loop(){
pinState = digitalRead(statuspin);
if(pinState==LOW){
digitalWrite(powerkey, HIGH);
delay(2000);
digitalWrite(powerkey, LOW);
}
if (verifica == 0) {
mySerial.println("AT+CGPSPWR=0"); // Desliga o modulo
delay(1000);
mySerial.println("AT+CGPSPWR=1"); // Liga o modulo GPS
Serial.println("Ligando modulo...");
delay(1000);
mySerial.println("AT+CGPSRST=0"); // Reseta GPS
Serial.println("Resetando GPS..");
delay(1000);
verifica = 1;
mySerial.flush();
}
limpa_buffer();
mySerial.flush();
delay(500);
mySerial.println("AT+CGPSINF=32"); // Solicita codigo NMEA
delay(1000);
numero_bytes = mySerial.available(); //Pega quantidade de bytes que estao na serial
while (mySerial.available() > 0) //Espera até que serial possua bytes
{
for(n=0; n
codigoNMEA[n] = mySerial.read();
}
}
if (n == 63) {
//Se o n for menor que 63 descarta pacote
//Alimenta as variaveis com o conteudo do buffer
Serial.print("Codigo NMEA: ");
Serial.println(codigoNMEA);
}
mySerial.flush(); //limpa buffer de entrada da serial
limpa_buffer();
}
void limpa_buffer()
{
memset(codigoNMEA,'\0',BUF_LEN);
}
pedronasc- Mensagens : 7
Data de inscrição : 01/10/2012
Re: SIM908 parou de responder no Terminal
Em outros teste com o código abaixo, é retornado uns caracteres estranhos..
#include
//Serial Relay - Arduino will patch a
//serial link between the computer and the GPRS Shield
//at 19200 bps 8-N-1
//Computer is connected to Hardware UART
//GPRS Shield is connected to the Software UART
SoftwareSerial mySerial(2, 3); //RX, TX
//ligar pino 1 (placa GSM) no pino 3 ARDUINO
int powerkey = 5;
int statuspin = 6;
int pinState = 0;
void setup()
{
pinMode(powerkey, OUTPUT);
pinMode(statuspin, INPUT);
mySerial.begin(9600); // the GPRS baud rate
Serial.begin(9600); // the GPRS baud rate
}
void loop()
{
pinState = digitalRead(statuspin);
if(pinState==LOW){
digitalWrite(powerkey, HIGH); // set the LED on
delay(2000);
digitalWrite(powerkey, LOW);
}
if(Serial.available())
{
mySerial.write(Serial.read());
}
else if(mySerial.available())
{
Serial.write(mySerial.read());
}
http://mySerial.println("AT");
//delay(500);
http://mySerial.println("AT+IPR=9600");
//delay(100);
http://mySerial.println("AT&W0");
//delay(100);
}
#include
//Serial Relay - Arduino will patch a
//serial link between the computer and the GPRS Shield
//at 19200 bps 8-N-1
//Computer is connected to Hardware UART
//GPRS Shield is connected to the Software UART
SoftwareSerial mySerial(2, 3); //RX, TX
//ligar pino 1 (placa GSM) no pino 3 ARDUINO
int powerkey = 5;
int statuspin = 6;
int pinState = 0;
void setup()
{
pinMode(powerkey, OUTPUT);
pinMode(statuspin, INPUT);
mySerial.begin(9600); // the GPRS baud rate
Serial.begin(9600); // the GPRS baud rate
}
void loop()
{
pinState = digitalRead(statuspin);
if(pinState==LOW){
digitalWrite(powerkey, HIGH); // set the LED on
delay(2000);
digitalWrite(powerkey, LOW);
}
if(Serial.available())
{
mySerial.write(Serial.read());
}
else if(mySerial.available())
{
Serial.write(mySerial.read());
}
http://mySerial.println("AT");
//delay(500);
http://mySerial.println("AT+IPR=9600");
//delay(100);
http://mySerial.println("AT&W0");
//delay(100);
}
pedronasc- Mensagens : 7
Data de inscrição : 01/10/2012
Re: SIM908 parou de responder no Terminal
Pessoal problema resolvido....
De alguma forma o baud rate do modulo mudou de valor... e ai nao consegui retornar os valores corretos..
setei novamente para 9600
AT+IPR=9600
e gravei a configuração
AT&W0
Obrigado
De alguma forma o baud rate do modulo mudou de valor... e ai nao consegui retornar os valores corretos..
setei novamente para 9600
AT+IPR=9600
e gravei a configuração
AT&W0
Obrigado
pedronasc- Mensagens : 7
Data de inscrição : 01/10/2012
Tópicos semelhantes
» SIM908 GPS GSM GPRS
» SIM908 , GPS NÃO SINCRONIZA...
» Sim900 Shield + Arduino MEGA
» Arduino UNO SIM 908
» SIM908 SHIELD
» SIM908 , GPS NÃO SINCRONIZA...
» Sim900 Shield + Arduino MEGA
» Arduino UNO SIM 908
» SIM908 SHIELD
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|