Git Product home page Git Product logo

Comments (4)

lanselambor avatar lanselambor commented on August 28, 2024

@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.

Welsyntoffie avatar Welsyntoffie commented on August 28, 2024

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.

Craftplorer avatar Craftplorer commented on August 28, 2024

@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.

Welsyntoffie avatar Welsyntoffie commented on August 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.