Hi serve professionals dear
I use sim 808 for receive sms and call , in normally state (without use interrupt) in serial monitor show detail of sms and call but when i use interrupt dont show any thing in my serial monitor
I use RI Behavior for interrupt:
RI: this pin will tell you whether the module is on and is there any calls and messages received. It will be pulled to high level when the module is on. And it will change to low for 120ms when a call or message is received.
i use RI Behavior for interrupt that detect a new message or call is has arrived
attachInterrupt(digitalPinToInterrupt(interruptPin), check, LOW)
this is my code without interrupt :
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
const byte interruptPin = 3;
void setup()
{
// Open serial communications and wait for port to open:
// attachInterrupt(digitalPinToInterrupt(interruptPin),check,LOW);
Serial.begin(9600);
mySerial.print("AT+CMGF=1\r"); // set SMS mode to text
delay(1000);
mySerial.print("AT+CNMI=2,2,0,0,0\r");
// blurt out contents of new SMS upon receipt to the GSM shield's serial out
delay(100);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
// mySerial.println("Hello, world?");
}
void loop() // run over and over
{
check();
/*if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());*/
}
void check(){
//Serial.println("test");
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
and this is my serial monitor when i send sms "hello" to sim808:
+CMT: "+989378171477","","17/04/04,13:31:01+18"
Hello
this is my cod with interrupt and i dont see any thing in Serial monitor:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
const byte interruptPin = 3;
void setup()
{
// Open serial communications and wait for port to open:
attachInterrupt(digitalPinToInterrupt(interruptPin),check,LOW);
Serial.begin(9600);
mySerial.print("AT+CMGF=1\r"); // set SMS mode to text
delay(1000);
mySerial.print("AT+CNMI=2,2,0,0,0\r");
// blurt out contents of new SMS upon receipt to the GSM shield's serial out
delay(100);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
// mySerial.println("Hello, world?");
}
void loop() // run over and over
{
//check();
/*if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());*/
}
void check(){
//Serial.println("test");
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
I have to use interrupt in my project !
please help me