Post a new topicPost a reply Page 2 of 4   [ 31 posts ]
Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: Arduino y módulo GPRS libelium (AYUDA)
PostPosted: Sun Apr 22, 2012 11:57 am 

Joined: Sun Apr 22, 2012 11:52 am
Posts: 4
Hola, estoy iniciandome es arduino. Pronto comprare un modulo GPRS para intentar hacer algo similar. Ya habeis consegido leer el sms? Estoy interesado en este tema.


Top
 Profile  
 
 Post subject: Re: Arduino y módulo GPRS libelium (AYUDA)
PostPosted: Tue Apr 24, 2012 7:18 am 

Joined: Fri Apr 13, 2012 9:46 am
Posts: 10
Migaor wrote:
Hola, estoy iniciandome es arduino. Pronto comprare un modulo GPRS para intentar hacer algo similar. Ya habeis consegido leer el sms? Estoy interesado en este tema.


Hola Migaor:

Consigo leer el SMS, pero a veces tiene dificultades (realmente todavía me cuesta entenderlo...). Te puedo enseñar el código que hice para que le heches un vistazo, y si compras el módulo, por lo menos ya tengas algo más avanzado en el tema este.

Code:
/*
PROGRAMA LECTOR DE SMS CON RESPUESTA SEGÚN CONTENIDO
*/

int led = 13;                                  // Salida en Arduino del relé ("pinMode" en "void setup")
int onModulePin = 2;                           // Pin de conexión del módulo GSM ("pinMode" en "void setup")
int shutdown = 0;                              // Estado de recepción del módulo GSM
int avav = 15;                                 // Comparador de "Serial.available"
int avai = 0;                                  // Representa a "Serial.available"
int lectura = 0;                               // Representa a "Serial.read"
int state = 0;                                 // Estado de la salida (0=Inactiva / 1=Activa)
char doblecom = 34;                            // Combinación de teclas (Dobles comillas)
char ctrlz = 26;                               // Combinación de teclas (Control + Z) para finalización de SMS's

void testModule() {                            // Borrado del búfer
  Serial.flush();
}

void switchModule() {                          // Arranca el módulo GSM
  digitalWrite(onModulePin,HIGH);
  delay(2000);
  digitalWrite(onModulePin,LOW);
}

void setup(){
  pinMode(led, OUTPUT);
  pinMode(onModulePin, OUTPUT);
  Serial.begin(19200);                        // Velocidad de transmisión de datos (Puerto serie - USB)
  switchModule();                             // Llama a esta función para encender el módulo GSM
  delay(5000);
  Serial.println("AT+CMGF=1");                // Establece el modo SMS en texto
  delay(2000);
  Serial.println("AT+CMGD=1");                // Borra la memoria SMS a utilizar (ACTIVAR PARA USO FINAL)
  delay(2000);
  // Serial.println("AT*PSCPOF");             // Apaga el módulo GSM (NO SE UTILIZA)
}

void loop(){
  delay(2000);
  Serial.flush();
  while (Serial.available()) {
    Serial.read();
  }
  if (shutdown == 0) {
    delay(1000);
    Serial.println("AT+CMGR=1");               // Lectura de SMS recibido
    delay(110);
    Serial.flush();
    while (Serial.available()) {
      Serial.read();
    }
    delay(500);
    while (Serial.available()) {
      avai = Serial.available();
      lectura = Serial.read();
      if (avai == avav && lectura == 78) {
        digitalWrite(led,HIGH);
        Serial.print("STATE MODULE ON\n");               // Salida conectada
        shutdown = 3;
        state = 1;
        delay(2000);
        Serial.print("AT+CMGS=");                        // Envio de SMS al número reflejado
        Serial.print(doblecom);
        Serial.print("*********");
        Serial.println(doblecom);
        delay(1500);
        Serial.println("STATE MODULE ON (N)");           // Cuerpo del mensaje
        delay(500);
        Serial.println(ctrlz);                           // Finaliza el mensaje
        delay(2000);
      }
      if (avai == avav && lectura == 70) {
        digitalWrite(led,LOW);
        Serial.print("STATE MODULE OFF\n");              // Salida desconectada
        shutdown = 3;
        state = 0;
        delay(2000);
        Serial.print("AT+CMGS=");                        // Envio de SMS al número reflejado
        Serial.print(doblecom);
        Serial.print("*********");
        Serial.println(doblecom);
        delay(1500);
        Serial.println("STATE MODULE OFF (F)");          // Cuerpo del mensaje
        delay(500);
        Serial.println(ctrlz);                           // Finaliza el mensaje
        delay(2000);
      }
      if (avai == avav && lectura == 81) {
        Serial.print("SENDING STATE MODULE: ");          // Estado de salida
        if (state == 1) {
          Serial.print("STATE MODULE ON \n");
          shutdown = 3;
          delay(2000);
          Serial.print("AT+CMGS=");                      // Envio de SMS al número reflejado
          Serial.print(doblecom);
          Serial.print("*********");
          Serial.println(doblecom);
          delay(1500);
          Serial.println("STATE MODULE ON (Q)");         // Cuerpo del mensaje
          delay(500);
          Serial.println(ctrlz);                         // Finaliza el mensaje
          delay(2000);
        }
        if (state == 0) {
          Serial.print("STATE MODULE OFF \n");
          shutdown = 3;
          delay(2000);
          Serial.print("AT+CMGS=");                      // Envio de SMS al número reflejado
          Serial.print(doblecom);
          Serial.print("*********");
          Serial.println(doblecom);
          delay(1500);
          Serial.println("STATE MODULE OFF (Q)");        // Cuerpo del mensaje
          delay(500);
          Serial.println(ctrlz);                         // Finaliza el mensaje
          delay(2000);
        }
      }
      if (avai == avav && (lectura != 78 || lectura != 70 || lectura != 81)) {
        avav = avav - 1;
      }
      Serial.print(avai, DEC);
      Serial.print(" - ");
      Serial.println(lectura, DEC);
      if (shutdown != 0) {
        Serial.flush();
        while (Serial.available()) {
          Serial.read();
        }
        avav = 0;
      }
    }
  }
  if (shutdown != 0) {
    delay(2000);
    Serial.println("AT+CMGD=1");           // Borra el SMS si ha sido leido
    delay(2000);
    shutdown = shutdown - 1;
    Serial.flush();
    while (Serial.available()) {
      Serial.read();
    }
    avav = 15;
  }
  delay(2000);
}


Si no se entiende algo, avisame.
Un saludo.

PD: Si alguien me puede ayudar a mejorar el código, lo agradecería, no logro conseguir guardar correctamente las respuestas de los comandos..., gracias.


Top
 Profile  
 
 Post subject: Re: Arduino y módulo GPRS libelium (AYUDA)
PostPosted: Wed Apr 25, 2012 11:28 am 

Joined: Sun Apr 22, 2012 11:52 am
Posts: 4
Muchas gracias yanmy30.
Ya te comentare.


Top
 Profile  
 
 Post subject: Re: Arduino y módulo GPRS libelium (AYUDA)
PostPosted: Wed Apr 25, 2012 11:38 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 2027
Gracias a los dos por vuestra colaboración.

Un saludo.


Top
 Profile  
 
 Post subject: Re: Arduino y módulo GPRS libelium (AYUDA)
PostPosted: Wed Apr 25, 2012 11:51 am 

Joined: Sun Apr 22, 2012 11:52 am
Posts: 4
¿Puedes explicarme que verificas (significado de los valores) con los valores 78, 70 y 81?
if (avai == avav && (lectura != 78 || lectura != 70 || lectura != 81)) {

Gracias.


Top
 Profile  
 
 Post subject: Re: Arduino y módulo GPRS libelium (AYUDA)
PostPosted: Thu May 03, 2012 7:37 am 

Joined: Fri Apr 13, 2012 9:46 am
Posts: 10
Por supuesto, son números decimales que señalan en arduino una posición de la tabla ASCII para pasarlos a caracteres. Para que lo entiendas, es lo mismo que si pones lo siguiente:
if (avai == avav && (lectura != 'N' || lectura != 'F' || lectura != 'Q')) {

Este código es un poco confuso, pero según pasa tiempo, lo voy mejorando día a día, aquí va el último que he desarrollado:

Code:
/*
PROGRAMA LECTOR DE SMS CON RESPUESTA SEGÚN CONTENIDO
Smarli_V3_JM3_ProtoboardReducido
Creado por Juan Miguel López (ANDALUCIA, ESPAÑA)
*/

// VARIABLES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// Salidas digitales para reles en Arduino
int rele1=8;
int rele2=9;
int rele3=10;
int rele4=11;
int rele5=12;
int rele6=13;

int sms=0;
char number[200];
int y=0;
char array[200];
int x=0;
int onModulePin=2; // Pin de conexión del módulo GSM ("pinMode" en "void setup")
int shutdown=0; // Estado de recepción del módulo GSM
int avai=0; // Representa a "Serial.available"
char lectura=0; // Representa a "Serial.read"
int chutop=0; // Activa la lectura de SMS tras obtener el número del mismo
int state=0; // Estado de la salida actual (0=Inactiva / 1=Activa)
int exit0=0; // Posición de la salida
int state1=0; // Estado de la salida 1 (0=Inactiva / 1=Activa)
int state2=0; // Estado de la salida 2 (0=Inactiva / 1=Activa)
int state3=0; // Estado de la salida 3 (0=Inactiva / 1=Activa)
int state4=0; // Estado de la salida 4 (0=Inactiva / 1=Activa)
int state5=0; // Estado de la salida 5 (0=Inactiva / 1=Activa)
int state6=0; // Estado de la salida 6 (0=Inactiva / 1=Activa)
char doblecom=34; // Combinación de teclas (Dobles comillas)
char ctrlz=26; // Combinación de teclas (Control + Z) para finalización de SMS's
int d=0;
int rec=0;
int cont=0;
int lee=0;

// FUNCIONES ADICIONALES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
void testModule(){Serial.flush();} // Borrado del búfer

void replyon(){
  Serial.print("Estado del modulo "); // Salida conectada
  Serial.print(exit0,DEC);
  Serial.print(": ENCENDIDO\n");
  shutdown=3;
  delay(2000);
  Serial.print("AT+CMGS="); // Envio de SMS
  Serial.print(doblecom);
  y=0;
  while(number[y]){
    Serial.print(number[y]);
    y++;
  }
  y=0;
  Serial.println(doblecom);
  delay(1500);
  Serial.print("Estado del modulo "); // Cuerpo del mensaje
  Serial.print(exit0,DEC);
  Serial.println(": ENCENDIDO");
  delay(500);
  Serial.println(ctrlz); // Finaliza el mensaje
  delay(1000);
  while (Serial.available()){Serial.read();}
}

void replyoff(){
  Serial.print("Estado del modulo "); // Salida conectada
  Serial.print(exit0,DEC);
  Serial.print(": APAGADO\n");
  shutdown=3;
  delay(2000);
  Serial.print("AT+CMGS="); // Envio de SMS al número reflejado
  Serial.print(doblecom);
  y=0;
  while(number[y]){
    Serial.print(number[y]);
    y++;
  }
  y=0;
  Serial.println(doblecom);
  delay(1500);
  Serial.print("Estado del modulo "); // Cuerpo del mensaje
  Serial.print(exit0,DEC);
  Serial.println(": APAGADO");
  delay(500);
  Serial.println(ctrlz); // Finaliza el mensaje
  delay(1000);
  Serial.flush();
  while (Serial.available()){Serial.read();}
}

void replyquery(){
  Serial.print("Enviando SMS con el estado del modulo "); // Estado de salida
  Serial.print(exit0,DEC);
  Serial.print(": ");
  if (state==1){
    Serial.print("ENCENDIDO\n");
    shutdown=3;
    delay(2000);
    Serial.print("AT+CMGS="); // Envio de SMS al número reflejado
    Serial.print(doblecom);
    y=0;
    while(number[y]){
      Serial.print(number[y]);
      y++;
    }
    y=0;
    Serial.println(doblecom);
    delay(1500);
    Serial.print("Estado del modulo "); // Cuerpo del mensaje
    Serial.print(exit0,DEC);
    Serial.println(": ENCENDIDO (Consulta)");
    delay(500);
    Serial.println(ctrlz); // Finaliza el mensaje
    delay(1000);
    Serial.flush();
    while (Serial.available()){Serial.read();}
  }
  if (state==0){
    Serial.print("APAGADO\n");
    shutdown=3;
    delay(4000);
    Serial.print("AT+CMGS="); // Envio de SMS al número reflejado
    Serial.print(doblecom);
    y=0;
    while(number[y]){
      Serial.print(number[y]);
      y++;
    }
    y=0;
    Serial.println(doblecom);
    delay(1500);
    Serial.print("Estado del modulo "); // Cuerpo del mensaje
    Serial.print(exit0,DEC);
    Serial.println(": APAGADO (Consulta)");
    delay(500);
    Serial.println(ctrlz); // Finaliza el mensaje
    delay(1000);
    Serial.flush();
    while (Serial.available()){Serial.read();}
  }
}

void replyonG(){
  Serial.print("Estado de todos los modulos: ENCENDIDO\n");
  shutdown=3;
  delay(2000);
  Serial.print("AT+CMGS="); // Envio de SMS
  Serial.print(doblecom);
  y=0;
  while(number[y]){
    Serial.print(number[y]);
    y++;
  }
  y=0;
  Serial.println(doblecom);
  delay(1500);
  Serial.println("Estado de todos los modulos: ENCENDIDO"); // Cuerpo del mensaje
  delay(500);
  Serial.println(ctrlz); // Finaliza el mensaje
  delay(1000);
  while (Serial.available()){Serial.read();}
}

void replyoffG(){
  Serial.print("Estado de todos los modulos: APAGADO\n");
  shutdown=3;
  delay(2000);
  Serial.print("AT+CMGS="); // Envio de SMS
  Serial.print(doblecom);
  y=0;
  while(number[y]){
    Serial.print(number[y]);
    y++;
  }
  y=0;
  Serial.println(doblecom);
  delay(1500);
  Serial.println("Estado de todos los modulos: APAGADO"); // Cuerpo del mensaje
  delay(500);
  Serial.println(ctrlz); // Finaliza el mensaje
  delay(1000);
  while (Serial.available()){Serial.read();}
}

void replyqueryG(){
  shutdown=3;
  delay(2000);
  Serial.print("AT+CMGS="); // Envio de SMS
  Serial.print(doblecom);
  y=0;
  while(number[y]){
    Serial.print(number[y]);
    y++;
  }
  y=0;
  Serial.println(doblecom);
  delay(1500);
  Serial.print("Estado de todos los modulos: "); // Cuerpo del mensaje
  if(state1==1){Serial.print("Mod.1: ON; ");}
  if(state1==0){Serial.print("Mod.1: OFF; ");}
  if(state2==1){Serial.print("Mod.2: ON; ");}
  if(state2==0){Serial.print("Mod.2: OFF; ");}
  if(state3==1){Serial.print("Mod.3: ON; ");}
  if(state3==0){Serial.print("Mod.3: OFF; ");}
  if(state4==1){Serial.print("Mod.4: ON; ");}
  if(state4==0){Serial.print("Mod.4: OFF; ");}
  if(state5==1){Serial.print("Mod.5: ON; ");}
  if(state5==0){Serial.print("Mod.5: OFF; ");}
  if(state6==1){Serial.println("Mod.6: ON.");}
  if(state6==0){Serial.println("Mod.6: OFF");}
  delay(500);
  Serial.println(ctrlz); // Finaliza el mensaje
  delay(1000);
  while (Serial.available()){Serial.read();}
}

void switchModule(){ // Arranca el módulo GSM
  digitalWrite(onModulePin,HIGH);
  delay(2000);
  digitalWrite(onModulePin,LOW);
}

// FUNCIONES PRINCIPALES <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
void setup(){
  pinMode(rele1,OUTPUT);
  pinMode(rele2,OUTPUT);
  pinMode(rele3,OUTPUT);
  pinMode(rele4,OUTPUT);
  pinMode(rele5,OUTPUT);
  pinMode(rele6,OUTPUT);
  pinMode(onModulePin,OUTPUT);
  Serial.begin(19200); // Velocidad de transmisión de datos (Puerto serie - USB)
  switchModule(); // Llama a esta función para encender el módulo GSM
  delay(4000);
  Serial.println("AT+CMGF=1"); // Establece el modo SMS en texto
  delay(4000);
  //Serial.println("AT+CMGD=1,4"); // Borra la memoria SMS a utilizar
  delay(4000);
}

void loop(){
  delay(1000);
  Serial.flush();
  while (Serial.available()>0){
    Serial.read();
  }
  // LECTURA NUMERO SMS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  if (shutdown==0 && chutop==0) {
    if (sms==0) {
      delay(1000);
      Serial.println("AT+CMGR=1");
      delay(1000);
      x=0;
      while (Serial.available()) {
        avai=Serial.available();
        array[x]=Serial.read();
        Serial.print(array[x]);
        x++;
        if (avai==1 && array[16]!='S') {
          sms=1;
          x=0;
        }
        if (avai==1 && array[16]=='S') {
          x=0;
        }
      }
      if (sms==1) {
        x=0;
        y=0;
        while(array[x]!='"') {
          x++;
        }
        x++;
        while(array[x]!='"') {
          x++;
        }
        x++;
        while(array[x]!='"') {
          x++;
        }
        x++;
        while(array[x]!='"') {
          number[y]=array[x];
          x++;
          y++;
        }
        chutop=1;
        sms=0;
        lee=0;
        delay(1000);
        Serial.println();
        Serial.flush();
        while (Serial.available()>0) {
          Serial.read();
        }
        delay(2000);
      }
      x=0;
      y=0;
    }
  }
// LECTURA TEXTO SMS Y ENVIO DE NOTIFICACIÓN <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  if (shutdown==0 && chutop==1) {
    Serial.println("AT+CMGR=1"); // Lectura de SMS recibido
    lee++;
    delay(100);
    cont++;
    if(cont==4) {
      cont=2;
    }
    Serial.flush();
    while (Serial.available()>0) {
      lectura=Serial.read();
      Serial.print(lectura);
    }
    delay(500);
    while (Serial.available()>0) {
      lectura=Serial.read();
      Serial.print(lectura);
      // BLOQUE 1 -------------------------------------------------------------------------------------------------------------------------
      if (lectura=='1') {
        Serial.available();
        lectura=Serial.read();
        Serial.print(">>");
        Serial.println(lectura);
        if (lectura=='N' || lectura=='n') {
          digitalWrite(rele1,HIGH);
          state1=1;
          exit0=1;
          replyon();
        }
        if (lectura=='F' || lectura=='f') {
          digitalWrite(rele1,LOW);
          state1=0;
          exit0=1;
          replyoff();
        }
        if (lectura=='Q' || lectura=='q') {
          state=state1;
          exit0=1;
          replyquery();
        }
      }
      // BLOQUE 2 -----------------------------------------------------------------------------------------------------------------------
      if (lectura=='2') {
        Serial.available();
        lectura=Serial.read();
        Serial.print(">>");
        Serial.println(lectura);
        if (lectura=='N' || lectura=='n') {
          digitalWrite(rele2,HIGH);
          state2=1;
          exit0=2;
          replyon();
        }
        if (lectura=='F' || lectura=='f') {
          digitalWrite(rele2,LOW);
          state2=0;
          exit0=2;
          replyoff();
        }
        if (lectura=='Q' || lectura=='q') {
          state=state2;
          exit0=2;
          replyquery();
        }
      }
      // BLOQUE 3 --------------------------------------------------------------------------------------------------------------------------
      if (lectura=='3') {
        Serial.available();
        lectura=Serial.read();
        Serial.print(">>");
        Serial.println(lectura);
        if (lectura=='N' || lectura=='n') {
          digitalWrite(rele3,HIGH);
          state3=1;
          exit0=3;
          replyon();
        }
        if (lectura=='F' || lectura=='f') {
          digitalWrite(rele3,LOW);
          state3=0;
          exit0=3;
          replyoff();
        }
        if (lectura=='Q' || lectura=='q') {
          state=state3;
          exit0=3;
          replyquery();
        }
      }
      // BLOQUE 4 -------------------------------------------------------------------------------------------------------------------------
      if (lectura=='4') {
        Serial.available();
        lectura=Serial.read();
        Serial.print(">>");
        Serial.println(lectura);
        if (lectura=='N' || lectura=='n') {
          digitalWrite(rele4,HIGH);
          state4=1;
          exit0=4;
          replyon();
        }
        if (lectura=='F' || lectura=='f') {
          digitalWrite(rele4,LOW);
          state4=0;
          exit0=4;
          replyoff();
        }
        if(lectura=='Q' || lectura=='q') {
          state=state4;
          exit0=4;
          replyquery();
        }
      }
      // BLOQUE 5 -------------------------------------------------------------------------------------------------------------------------
      if(lectura=='5') {
        Serial.available();
        lectura=Serial.read();
        Serial.print(">>");
        Serial.println(lectura);
        if(lectura=='N' || lectura=='n') {
          digitalWrite(rele5,HIGH);
          state5=1;
          exit0=5;
          replyon();
        }
        if(lectura=='F' || lectura=='f') {
          digitalWrite(rele5,LOW);
          state5=0;
          exit0=5;
          replyoff();
        }
        if(lectura=='Q' || lectura=='q') {
          state=state5;
          exit0=5;
          replyquery();
        }
      }
      // BLOQUE 6 -------------------------------------------------------------------------------------------------------------------------
      if(lectura=='6') {
        Serial.available();
        lectura=Serial.read();
        Serial.print(">>");
        Serial.println(lectura);
        if(lectura=='N' || lectura=='n') {
          digitalWrite(rele6,HIGH);
          state6=1;
          exit0=6;
          replyon();
        }
        if(lectura=='F' || lectura=='f') {
          digitalWrite(rele6,LOW);
          state6=0;
          exit0=6;
          replyoff();
        }
        if(lectura=='Q' || lectura=='q') {
          state=state6;
          exit0=6;
          replyquery();
        }
      }
      // BLOQUE GLOBAL -------------------------------------------------------------------------------------------------------------------------
      if(lectura=='0') {
        Serial.available();
        lectura=Serial.read();
        Serial.print(">>");
        Serial.println(lectura);
        if(lectura=='N' || lectura=='n') {
          digitalWrite(rele1,HIGH);
          digitalWrite(rele2,HIGH);
          digitalWrite(rele3,HIGH);
          digitalWrite(rele4,HIGH);
          digitalWrite(rele5,HIGH);
          digitalWrite(rele6,HIGH);
          state1=1;
          state2=1;
          state3=1;
          state4=1;
          state5=1;
          state6=1;
          replyonG();
        }
        if(lectura=='F' || lectura=='f') {
          digitalWrite(rele1,LOW);
          digitalWrite(rele2,LOW);
          digitalWrite(rele3,LOW);
          digitalWrite(rele4,LOW);
          digitalWrite(rele5,LOW);
          digitalWrite(rele6,LOW);
          state1=0;
          state2=0;
          state3=0;
          state4=0;
          state5=0;
          state6=0;
          replyoffG();
        }
        if(lectura=='Q' || lectura=='q') {
          replyqueryG();
        }
      }
      // BLOQUE ERROR -------------------------------------------------------------------------------------------------------------------------
      if(lee>=20) {
        Serial.print("Envio SMS Error, fin de lectura\n");
        shutdown=3;
        delay(2000);
        Serial.print("AT+CMGS="); // Envio de SMS al número reflejado
        Serial.print(doblecom);
        y=0;
        while(number[y]) {
          Serial.print(number[y]);
          y++;
        }
        y=0;
        Serial.println(doblecom);
        delay(1500);
        Serial.print("SMS Error"); // Cuerpo del mensaje
        delay(500);
        Serial.println(ctrlz); // Finaliza el mensaje
        delay(1000);
        Serial.flush();
        while (Serial.available()) {
          Serial.read();
        }
      }
      // FINAL DE BLOQUES -----------------------------------------------------------------------------------------------------------------
      rec++;
      if(shutdown!=0 || rec==100) {
        Serial.flush();
        while(Serial.available()) {
          Serial.read();
        }
        rec=0;
      }
    }
  }
  if(shutdown!=0) {
    delay(1000);
    Serial.println("AT+CMGD=1,4"); // Borra el SMS si ha sido leido
    delay(1000);
    shutdown--;
    Serial.flush();
    while(Serial.available()) {
      Serial.read();
    }
    chutop=0;
    // BORRADO DE NUMERO TELEFONICO ALMACENADO <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    y=0;
    while(number[y]) {
      number[y]='\0';
      y++;
    }
    y=0;
  }
  delay(1000);
}


Cualquier avance que vaya realizando, os iré informando.
Igualmente, si teneis información para ayudarme o alguna corrección que otra, me vendría muy bien, gracias por la paciencia y sobretodo, por la ayuda, GRACIAS.


Top
 Profile  
 
 Post subject: Re: Arduino y módulo GPRS libelium (AYUDA)
PostPosted: Thu May 03, 2012 7:49 am 

Joined: Fri Apr 13, 2012 9:46 am
Posts: 10
Perdonadme por la tardanza en volver a las andadas, pero esta semana pasada ha sido fiesta en Jerez con el Gran Premio de MotoGP, y no he podido hacer mucho.

Tengo una nueva duda, vereis, tengo un módulo nuevo, Arduino Ethernet Shield, y la verdad no se si es compatible con el módulo GPRS o si alguien lo ha probado antes que yo.
La cosa se complica porque sería conectar sobre el módulo de Arduino Duemilanove, el módulo de Arduino Ethernet Shield y sobre este, el módulo GPRS. ¿Es esto posible?

Lo probé pero sin programar ni nada, y fisicamente lo que veo es que el módulo GPRS no encaja perfectamente sobre el modulo de Ethernet Shield porque tropieza con el conector de RJ-45, y a su vez la conexión de ICSP en la placa de Arduino Duemilanove no llega a conectar con el módulo GPRS (¿habría que puentearlo?).

Si intento conectarlos, ¿estropearé las placas?, o saldrán con vida de la prueba...
Tampoco sé como actuará el modulo GPRS junto a la placa de Ethernet Shield...
¡¡¡Ayuda!!!, y muchas gracias por todo.


Top
 Profile  
 
 Post subject: Re: Arduino y módulo GPRS libelium (AYUDA)
PostPosted: Thu May 03, 2012 7:56 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 2027
Hola yanmy30,

En principio si que podrías conectarlo (el módulo Ethernet usa SPI, y el GRPS la uart) , pero necesitas alimentar el módulo GPRS por medio de cables. Todo depende del montaje que realices, si conectas todo correctamente no tiene porque dar problemas.

Un saludo


Top
 Profile  
 
 Post subject: Re: Arduino y módulo GPRS libelium (AYUDA)
PostPosted: Thu May 03, 2012 8:21 am 

Joined: Fri Apr 13, 2012 9:46 am
Posts: 10
Yo tengo alimentado el módulo GPRS con una alimentación externa (5V-2A), ¿tendría que conectar de todos modos el ICSP de Arduino Duemilanove al módulo GPRS?

Gracias.


Top
 Profile  
 
 Post subject: Re: Arduino y módulo GPRS libelium (AYUDA)
PostPosted: Thu May 03, 2012 11:58 am 

Joined: Fri Apr 13, 2012 9:46 am
Posts: 10
Tengo un problema con el módulo Ethernet de Arduino.

Para utilizar correctamente el módulo GPRS de Libelium, necesito las salidas digitales 8,9,10,11,12 y 13 libres para operar con estos, pero el módulo Ethernet de Arduino utiliza las salidas digitales 10,11,12 y 13 para la comunicación con W5100 (SPI).
¿No hay manera de conseguir operar con estos pines digitales? Es la primera vez que utilizo Arduino Ethernet y ando un poco perdido...

Gracias por todo, un saludo.

libelium-dev, muchas gracias por toda la ayuda.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 2 of 4   [ 31 posts ]
Go to page Previous  1, 2, 3, 4  Next


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use