PIR sensor and gsm shield problem???


when gsm shield off pir sensor work fine when turn gsm shield on pir sensor doesnt work can me? code

code: [select]
//#include "sim900.h"
#include <softwareserial.h>
#include "sms.h"
#include "gsm.h"
//#include "string.h"

#define debug_code_on
#define debug_action_on

smsgsm sms;


boolean started=false;
boolean startsms=false;
char smsbuffer[160];
char n_in[16];
char n_ref[12];
char  msg[1];
char pompe_on[160] = "pompeon";
char pompe_off[160] = "pompeoff";
char vanne_on[160] = "vanneon";
char vanne_off[160] = "vanneoff";
int swtch=13;
int pirsensor=2;
int incomingbyte;
int val = 0;   


void setup()
{
 
  // digit
  pinmode(swtch, output);
pinmode(pirsensor, input);

  //serial connection.
  serial.begin(9600);
 
  serial.println("gsm shield testing.");

  // gsm start
  if (gsm.begin(9600))
  {
    serial.println("\nstatus=ready");
    started=true; 
  }
  else serial.println("\nstatus=idle");
 
  if(started){
    #ifdef debug_code_on
    serial.println("mise en ligne");
    #endif
   
    gsm.simplewriteln("at+cmee=2");
    delay(5000);
    #ifdef debug_code_on
    serial.print("at+cmee=2");
    gsm.whilesimpleread();
    #endif
//
// pin code
//
    #ifdef debug_code_on
    serial.println("pin code");
    #endif


//if (gsm.sendatcmdwaitresp("at+cpin ?", 1000, 100, "ready", 5) != 1 )
//      {
      gsm.simplewriteln("at+cpin=2343");
      delay(5000);
      #ifdef debug_code_on
      serial.print("at+cpin=####");
      gsm.whilesimpleread();
      #endif
//      }

//
// init send sms
//
    gsm.simplewriteln("at+clip=1");
    delay(500);
    #ifdef debug_code_on
    serial.print("at+clip=1");
    gsm.whilesimpleread();
    #endif

   
    gsm.simplewriteln("at+csca ?");
    delay(5000);
    #ifdef debug_code_on
    serial.print("at+csca ?");
    gsm.whilesimpleread();
    #endif
       
    gsm.simplewriteln("at+cmgf=1");
    delay(5000);
    #ifdef debug_code_on
    serial.print("at+cmgf=1");
    gsm.whilesimpleread();
    #endif

//
// cmd low
//
    #ifdef debug_action_on
    serial.println("init pump");
    #endif
    digitalwrite(swtch, low);
   
   

  }
 
 

};



}
void loop()
{ if(digitalread(pirsensor)==high){   // read input pin
  digitalwrite(swtch, high);      // sets led button's value
  delay(1000);   
digitalwrite(swtch, low);   // delay in milisecond. 3000 = 3 second
  }
  if(started){
   

  }
};
 

code: [select]
char pompe_on[160] = "pompeon";
char pompe_off[160] = "pompeoff";
char vanne_on[160] = "vanneon";
char vanne_off[160] = "vanneoff";


is there reason create 160 byte arrays hold maximum of 9 bytes each?

i don't know how sram softwareserial, gsm , sms libraries use, wasting heck of lot of limited resource.


Arduino Forum > Using Arduino > Programming Questions > PIR sensor and gsm shield problem???


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial