// include the GSM library
#include <GSM.h>
// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;
int led = 13; //pin 13
void setup()
{
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Serial.println("SMS Messages Receiver");
}
void loop()
{
char c;
while(c=sms.read())
Serial.print(c);
// If there are any SMSs available()
if (sms.available())
{
c=Serial.read();
{
if( c == 'a')
{
digitalWrite(13,HIGH);
}
if(c == 'o'){
digitalWrite(13, LOW);}
// Delete message from modem memory
sms.flush();
Serial.println("MESSAGE DELETED");
}
delay(1000);
}
}
This is the code that we made (from several sources). We have compiled it, and uploaded into Arduino Uno R3 which has been attached with GSM SIM900.
We made it so when we sent "a" the led will turn on while "o" will turn it off.
But then, we sent a text, but nothing happened.
We're desperately need help, thanks.
PS: To connect the arduino to the breadboard, well the led will be used on breadboard, should we use RX and TX?