Show Posts
Pages: [1]
1  Topics / Product Design / Arduino Scheduler not working on: May 08, 2013, 04:21:19 am
hi all, i am trying to use time scheduler but i have a problem, with that ,
i toke this code from  here http://playground.arduino.cc/Code/Scheduler#Example
and i downloaded the Scheduler.h but still it dosnot compile  smiley-cry

so dose any one can provide any help ?

code :

Code:
#include <Scheduler.h> // [url=http://playground.arduino.cc/uploads/Code/Scheduler.zip]Scheduler.zip[/url]

Scheduler scheduler = Scheduler();      //create a scheduler

const byte ledPin = 13;               //LED on pin 13

void setup(){
  Serial.begin(9600);                 //Iitialize the UART
  pinMode(ledPin,OUTPUT);             //set pin 13 to OUTPUT
}

void loop(){
  scheduler.update();                 //update the scheduler, maybe it is time to execute a function?

  if (Serial.available()){            //if we have recieved anything on the Serial
    scheduler.schedule(setHigh,500);  //schedule a setHigh call in 500 milliseconds
    Serial.flush();                   //flush Serial so we do not schedule multiple setHigh calls
  }
}

void setHigh(){
  digitalWrite(ledPin,HIGH);          //set ledPin HIGH
  scheduler.schedule(setLow,500);     //schedule setLow to execute in 500 milliseconds
}

void setLow(){
  digitalWrite(ledPin,LOW);           //set ledPin LOW
}
2  Using Arduino / Programming Questions / Arduino time Scheduler on: May 08, 2013, 12:52:32 am
hi all, i am trying to use time scheduler but i have a problem, with that ,
i toke this code from  here http://playground.arduino.cc/Code/Scheduler#Example
and i downloaded the Scheduler.h but still it dosnot compile  smiley-cry

so dose any one can provide any help ?

code :

Code:
#include <Scheduler.h> // [url=http://playground.arduino.cc/uploads/Code/Scheduler.zip]Scheduler.zip[/url]

Scheduler scheduler = Scheduler();      //create a scheduler

const byte ledPin = 13;               //LED on pin 13

void setup(){
  Serial.begin(9600);                 //Iitialize the UART
  pinMode(ledPin,OUTPUT);             //set pin 13 to OUTPUT
}

void loop(){
  scheduler.update();                 //update the scheduler, maybe it is time to execute a function?

  if (Serial.available()){            //if we have recieved anything on the Serial
    scheduler.schedule(setHigh,500);  //schedule a setHigh call in 500 milliseconds
    Serial.flush();                   //flush Serial so we do not schedule multiple setHigh calls
  }
}

void setHigh(){
  digitalWrite(ledPin,HIGH);          //set ledPin HIGH
  scheduler.schedule(setLow,500);     //schedule setLow to execute in 500 milliseconds
}

void setLow(){
  digitalWrite(ledPin,LOW);           //set ledPin LOW
}
3  Using Arduino / Networking, Protocols, and Devices / Re: GSM shild , Replay to sms , need help please on: May 05, 2013, 11:45:41 am
thank you very much,  is that means that SM5100B GSM dose not Support replay to SMS ?
what can i do ?

the receive part alone is working perfectly and the send part alone is also working perfectly but they dos not fit together  smiley-cry
4  Using Arduino / Networking, Protocols, and Devices / Re: GSM Shield on: May 04, 2013, 09:14:53 am
get the SM5100B from sparkfun smiley-razz
5  Using Arduino / Networking, Protocols, and Devices / GSM shild , Replay to sms , need help please on: May 04, 2013, 09:09:48 am
hi all ,
i am using arduino to control an  GSM SM100B  , every thing is working perfectly except when i want to send an sms after receive an sms
"replay to message ", i get this Error

Code:
O K > + C M G S : 2 5 O K + C M E E R R O R : 4

dose any one have any idea about that ?

my code :

Code:
#include <SoftwareSerial.h>  //Include the NewSoftSerial library to send serial commands to the cellular module.
    char inchar;                //Will hold the incoming character from the Serial Port.
    SoftwareSerial cell(2,3);    //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
    char mobilenumber[] = "0597010129";  // Replace xxxxxxxx with the recipient's mobile number

    void setup() {
    //GSM
    Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
    Serial.println("Initialize GSM module serial port for communication.");                       
    cell.begin(9600);
    delay(35000); // give time for GSM module to register on network etc.
    Serial.println("delay off");
    cell.println("AT+CMGF=1"); // set SMS mode to text
    delay(200);
    cell.println("AT+CNMI=3,3,0,0"); // set module to send SMS data to serial out upon receipt
    delay(200);
    }



    void loop() {   

     if(cell.available() >0)//If a character comes in, from the cellular module
     {
     inchar=cell.read();
     Serial.println(inchar);
     if (inchar=='#'){ // OK - the start of our command

       delay(10);
       inchar=cell.read();
       Serial.println(inchar); 

         if (inchar=='a'){

           delay(10);
           Serial.println("The folowing SMS : \n");
           inchar=cell.read();
           Serial.println(inchar);

           if (inchar=='0'){ //sequance = #a0

             Serial.println("#a0 was received");

         }
         else if (inchar=='1'){//sequance = #a1

            Serial.println("#a1 was received ");
            sendSms();

         }
     }
     cell.println("AT+CMGD=1,4");// AT command to delete all msgs
     Serial.println(" delete all SMS");
      }
    }//end of  if(cell.available() >0) {...}
    }

    void sendSms(){
    //cell.println("AT+CMGF=1"); // set SMS mode to text
    cell.print("AT+CMGS=");  // now send message...
    cell.print((char)34); // ASCII equivalent of "
    cell.print(mobilenumber);
    cell.println((char)34);  // ASCII equivalent of "
    delay(500); // give the module some thinking time
    cell.print(":D hello m3alleg :D");   // our message to send
    cell.println((char)26);  // ASCII equivalent of Ctrl-Z
    delay(20000);

}

6  Using Arduino / Networking, Protocols, and Devices / GSM , Replay to SMS problem ? on: May 03, 2013, 11:00:45 am
hi all ,
i am using arduino to control an SM100B GSM , every thing is working perfectly except when i want to send an sms after receive an sms
"replay to message ", i get this

Code:
O K > + C M G S : 2 5 O K + C M E E R R O R : 4

i know that CME ERROR: 4    means Operation not supported .
but what i can do to prevent it ?

dose any one have any idea about that ?

my  code :
Code:
#include <SoftwareSerial.h>  //Include the NewSoftSerial library to send serial commands to the cellular module.
    char inchar;                //Will hold the incoming character from the Serial Port.
    SoftwareSerial cell(2,3);    //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
    char mobilenumber[] = "0597010129";  // Replace xxxxxxxx with the recipient's mobile number

    void setup() {
    //GSM
    Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
    Serial.println("Initialize GSM module serial port for communication.");                      
    cell.begin(9600);
    delay(35000); // give time for GSM module to register on network etc.
    Serial.println("delay off");
    cell.println("AT+CMGF=1"); // set SMS mode to text
    delay(200);
    cell.println("AT+CNMI=3,3,0,0"); // set module to send SMS data to serial out upon receipt
    delay(200);
    }



    void loop() {  

     if(cell.available() >0)//If a character comes in, from the cellular module
     {
     inchar=cell.read();
     Serial.println(inchar);
     if (inchar=='#'){ // OK - the start of our command

       delay(10);
       inchar=cell.read();
       Serial.println(inchar);  

         if (inchar=='a'){

           delay(10);
           Serial.println("The folowing SMS : \n");
           inchar=cell.read();
           Serial.println(inchar);

           if (inchar=='0'){ //sequance = #a0

             Serial.println("#a0 was received");

         }
         else if (inchar=='1'){//sequance = #a1

            Serial.println("#a1 was received ");
            sendSms();

         }
     }
     cell.println("AT+CMGD=1,4");// AT command to delete all msgs
     Serial.println(" delete all SMS");
      }
    }//end of  if(cell.available() >0) {...}
    }

    void sendSms(){
    //cell.println("AT+CMGF=1"); // set SMS mode to text
    cell.print("AT+CMGS=");  // now send message...
    cell.print((char)34); // ASCII equivalent of "
    cell.print(mobilenumber);
    cell.println((char)34);  // ASCII equivalent of "
    delay(500); // give the module some thinking time
    cell.print(":D hello m3alleg :D");   // our message to send
    cell.println((char)26);  // ASCII equivalent of Ctrl-Z
    delay(20000);

}

Pages: [1]