Comments (4)
@Welsyntoffie I think you change examples/GPRS_ReadSMS like below,
int sms_pin = 6;
void loop() {
/* omitted code */
pinMode(sms_pin, OUTPUT);
digitalWrite(sms_pin, LOW);
}
void loop() {
messageIndex = gprs.isSMSunread();
if (messageIndex > 0) { //At least, there is one UNREAD SMS
Serial.print("Recieved Message.");
digitalWrite(sms_pin);
delay(200);
digitalWrite(sms_pin);
}
from gprs_sim900.
Not exactly what I had in mind. I receive alot of advertising messages. So any sms will toggle the pin.
What I had in mind was to send "1234 Relay1 On" to the gsm shield.
Then read the message, check if the password is a match, then read on, if sms text Relay1 On then sms_pin = HIGH.
If sms text Relay1 Off then sms_pin = LOW.
from gprs_sim900.
@Welsyntoffie Something like this should help. It just how to parse a string in Arduino and has not really something to do with this library.
void setup() {
Serial.begin(9600);
int password = 0;
char device[20] = {0};
unsigned int deviceIndex = 0;
char smsStr[] = "1254 Relay 1";
sscanf(smsStr, "%4u %19s %u", &password, device, &deviceIndex);
Serial.println(password);
Serial.println(device);
Serial.println(deviceIndex);
}
void loop() {
}
from gprs_sim900.
This worked for me. Thank you...
Modified the smsread example.
'''
String messagestring;
void setup() {
pinmode(13, OUTPUT);
void loop() {
// added following below the last Serial print of the example
messagestring = String(message); //creates a string from an array
if (messagestring.indexOf("Password") >= 0) {
if (messagestring.indexOf("Relay1 On") >= 0) {
digitalWrite(13, !digitalRead(13));
}
}
'''
This solved my mission and seems easy.
from gprs_sim900.
Related Issues (20)
- send SMS method return is still false HOT 8
- can't read sms sim800l HOT 5
- use serial2 mega HOT 1
- can't gprs.print ? HOT 2
- Can't use sendUSSDSynchronous HOT 4
- Serial Monitor error when sending long messages HOT 1
- Using with SIM800H HOT 2
- Connect Error HOT 1
- HTTP Post HOT 2
- Reason for checkSIMStatus being private HOT 2
- Ai-Thinker A6 HOT 1
- sendSms HOT 4
- get rid of error from AT+CMGF=1 HOT 1
- data transmission stops after few days HOT 1
- Loop handle example HOT 1
- Altsoftserial change HOT 1
- readSMS example HOT 2
- Error while interfacing with mega
- How to join Zoom meeting
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gprs_sim900.