Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Announcements
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9868 Discussions

Help!? GSM Galileo Gen2 Switch Led

As18
Beginner
1,094 Views

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
1 Solution
Pablo_M_Intel
Employee
96 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

1 Reply
Pablo_M_Intel
Employee
97 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

Reply