Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1,013 Views

Help!? GSM Galileo Gen2 Switch Led

Jump to solution

Hi so basically want to switch a io pin high or low by sms being received the problem is i dont understand how to store a message to compare to a pre set string which i would use as a command like for example char A ="on"... when smsreceived == A turn the led on but in my case im using Relays so off but same thing really.. ive been basically just trying different things ... heres what ive got so far any help would be Greatly appreciated.

/#

# include

char incoming_char[] = {"on"};

int led = 13;

void setup()

{

pinMode(led,OUTPUT);

Serial.begin(9600); // the GPRS baud rate

Serial1.begin(9600);

}

void loop() {

// put your main code here, to run repeatedly:

digitalWrite(led,HIGH);

SendTextMessage();

ReceiveTextMessage();

incoming_char=Serial1.println("AT++CPMS=\"SM\"");

if (incoming_char=='on')

{

digitalWrite(led,LOW);

delay(500);

}

delay(5000);

}

void SendTextMessage()

{

Serial1.print("AT+CMGF=1\r"); //Because we want to send the SMS in text mode

delay(1000);

Serial1.println("AT+CMGS=\"+353876373466\"");

delay(1000);

Serial1.println("Ready");

delay(1000);

Serial1.println((char)26); //the ASCII code of the ctrl+z is 26 (0x1A)

delay(1000);

Serial1.println();

}

void ReceiveTextMessage()

{

Serial1.println("AT+CMGF=1"); //Because we want to receive the SMS in text mode

delay(1000);

Serial1.println("AT+CPMS=\"SM\"");

delay(1000);

Serial1.println("AT+CMGL=\"ALL\""); // show message

}

0 Kudos

Accepted Solutions
Highlighted
Employee
15 Views

Hi AScallywag,

Have you checked these other threads about a similar issue? You might find some useful information in there.

/message/236037 https://communities.intel.com/message/236037

/docs/DOC-23562 https://communities.intel.com/docs/DOC-23562

You should be able to store the message in a string array, once the message is retrieved completely, you could access the information from the array to make the comparison.

Regards,

PabloM_Intel

View solution in original post

0 Kudos
1 Reply
Highlighted
Employee
16 Views

Hi AScallywag,

Have you checked these other threads about a similar issue? You might find some useful information in there.

/message/236037 https://communities.intel.com/message/236037

/docs/DOC-23562 https://communities.intel.com/docs/DOC-23562

You should be able to store the message in a string array, once the message is retrieved completely, you could access the information from the array to make the comparison.

Regards,

PabloM_Intel

View solution in original post

0 Kudos