#include <SoftwareSerial.h>
SoftwareSerial SIM900(6, 7);
void donothing();
char incoming_char=0;
void setup()
{
Serial.begin(19200); // for serial monitor
SIM900.begin(19200); // for GSM shield
//SIM900power(); // turn on shield
delay(20000); // give time to log on to network.
pinMode(2, OUTPUT);
pinMode(4, INPUT);
}
void loop()
{
// reading any text is available
if(SIM900.available() >0)
{
delay(3000);
while (digitalRead (4 == LOW)){
void donothing();
}
}
else if (digitalRead (4 == HIGH))
{
digitalWrite (2, HIGH);
delay (3000);
digitalWrite (2, LOW);
delay (3000);
SIM900.println("AT+CMGD=1,4"); // delete all SMS//Serial.print(incoming_char);
}
}
void donothing()
{
}
This is my new program, if any text message available it have to go for-> do nothing() loop, While digital read 4 th pin LOW, after that if next time received sms then only it has to go for do nothing loop().
without sms if I press the pin 4 is HIGH it has to blink the led pin 2 one time.
but my errors are
if it receive the sms after do nothing loop is executing but it is not retrieving after I low the pin 4 ,
and also if I didn't sent the sms it is directly make a HIGH on digital pin 2. without press the 4th pin it is continuously blinking lED. but if I press the 4th pin then only it have to blink the led pin 2 if I release 4 th pin it it should not do anything while next time button 4 press or receive sms.
#include <SoftwareSerial.h>
SoftwareSerial SIM900(6, 7);
void donothing();
char incoming_char=0;
void setup()
{
Serial.begin(19200); // for serial monitor
SIM900.begin(19200); // for GSM shield
//SIM900power(); // turn on shield
delay(20000); // give time to log on to network.
SIM900.print("AT+CMGF=1\r"); // set SMS mode to text
delay(100);
pinMode(2, OUTPUT);
pinMode(4, INPUT);
}
void loop()
{
// reading any text is available
if(SIM900.available() >0)
{
delay(3000);
while (digitalRead (4)== LOW)
Serial.print("hi");
{ }
}
delay(3000);
if (digitalRead(4) == HIGH)
{
digitalWrite (2, HIGH);
delay (3000);
digitalWrite (2, LOW);
delay (3000);
SIM900.println("AT+CMGD=1,4"); // delete all SMS//Serial.print(incoming_char);
}
}
void donothing()
{
}
yeah! but once I send the message it is entering the do nothing loop after I press it it is jumped to next part if release this again it is executing do nothing part, but exactly I need only one time do nothing have to work while I press 4 after that if I send the next time then only it have to work.
Venki:
yeah! but once I send the message it is entering the do nothing loop after I press it it is jumped to next part if release this again it is executing do nothing part, but exactly I need only one time do nothing have to work while I press 4 after that if I send the next time then only it have to work.