collapse

* Posts Recentes

Arame de Estendal por almamater
[Hoje às 16:16]


O que é isto ? por SerraCabo
[12 de Abril de 2024, 14:20]


Amplificador - Rockboard HA 1 In-Ear por almamater
[11 de Abril de 2024, 20:46]


Emulador NES em ESP32 por dropes
[10 de Abril de 2024, 15:30]


Meu novo robô por josecarlos
[29 de Março de 2024, 18:30]


Bateria - Portátil por almamater
[25 de Março de 2024, 22:14]


Escolher Osciloscópio por jm_araujo
[06 de Fevereiro de 2024, 23:07]


TP4056 - Dúvida por dropes
[31 de Janeiro de 2024, 14:13]


Leitura de dados por Porta Serie por jm_araujo
[22 de Janeiro de 2024, 14:00]


Distancia Cabo por jm_araujo
[08 de Janeiro de 2024, 16:30]

Autor Tópico: Duvida sim900  (Lida 3500 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline joaopedrocmp

  • Mini Robot
  • *
  • Mensagens: 246
Duvida sim900
« em: 15 de Maio de 2016, 23:47 »
Boas,
instalei uma biblioteca para o sim900, "gsm-gprs-gps-shield".

no caso seguinte recebo uma sms e é apresentado o numero e o conteúdo no serial monitor.
Código: [Seleccione]
#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to send and receive SMS.

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];
void setup()
{
     //Serial connection.
     Serial.begin(9600);
     Serial.println("GSM Shield testing.");
     //Start configuration of shield with baudrate.
     //For http uses is raccomanded to use 4800 or slower.
     if (gsm.begin(2400)) {
          Serial.println("\nstatus=READY");
          started=true;
     } else Serial.println("\nstatus=IDLE");

    // if(started) {
          //Enable this two lines if you want to send an SMS.
          //if (sms.SendSMS("3471234567", "Arduino SMS"))
          //Serial.println("\nSMS sent OK");
     //}
};

void loop()
{
 
     if(started) {
          //Read if there are messages on SIM card and print them.
        /**  deprecated method
        if(gsm.readSMS(smsbuffer, 160, n, 20)) {
               Serial.println(n);
               Serial.println(smsbuffer);
          }
          **/

         
          //get 1st sms
          sms.GetSMS(1,n,20,smsbuffer,160);
          Serial.println(n);
          Serial.println(smsbuffer);
          delay(3000);
         
     }
};

o que necessito é fazer uma ação caso o numero e o conteúdo seja o que eu quero.
ja igualei o smsbuffer a uma string e envio o que esta nessa string e nao funciona.
opinioes?

Offline metRo_

  • Administrator
  • Mini Robot
  • *****
  • Mensagens: 3.753
Re: Duvida sim900
« Responder #1 em: 16 de Maio de 2016, 21:04 »
Como estavas a fazer a comparação das strings?

Offline joaopedrocmp

  • Mini Robot
  • *
  • Mensagens: 246
Re: Duvida sim900
« Responder #2 em: 16 de Maio de 2016, 22:15 »
Criei uma string   smstext {'a','d','u','i','n','o',,} depois fiz um , se smsfuffer == smstext,liga led

Offline metRo_

  • Administrator
  • Mini Robot
  • *****
  • Mensagens: 3.753
Re: Duvida sim900
« Responder #3 em: 17 de Maio de 2016, 08:28 »
Criei uma string   smstext {'a','d','u','i','n','o',,} depois fiz um , se smsfuffer == smstext,liga led

http://lmgtfy.com/?q=string+compare+c# :)