SMS-LED

A simple snippet to make an LED light up when receiving a SMS, with one of Bennedetta's GSM Shields

Lighting the LED pin 13 in the Arduino board. After several failed attempts of writing from Arduino Serial Monitor, we decided to do it through Coolterm. 

This is the code:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);
char inChar = 0;
char message[] = "que pasa HUMBA!";

void setup()  
{
  Serial.begin(9600);
  Serial.println("Hello Debug Terminal!");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  
  pinMode(13, OUTPUT);
  
//  
//  //Turn off echo from GSM
//  mySerial.print("ATE0");
//  mySerial.print("\r");
//  delay(300);
//  
//  //Set the module to text mode
//  mySerial.print("AT+CMGF=1");
//  mySerial.print("\r");
//  delay(500);
//  
//  //Send the following SMS to the following phone number
//  mySerial.write("AT+CMGS=\"");
//  // CHANGE THIS NUMBER! CHANGE THIS NUMBER! CHANGE THIS NUMBER! 
//  // 129 for domestic #s, 145 if with + in front of #
//  mySerial.write("6313180614\",129");
//  mySerial.write("\r");
//  delay(300);
//  // TYPE THE BODY OF THE TEXT HERE! 160 CHAR MAX!
//  mySerial.write(message);
//  // Special character to tell the module to send the message
//  mySerial.write(0x1A);
//  delay(500);
}

void loop() // run over and over
{
  if (mySerial.available()){
    inChar = mySerial.read();
    Serial.write(inChar);
    digitalWrite(13, HIGH);
    delay(20);
    digitalWrite(13, LOW);
    }
    
  if (Serial.available()>0){
    mySerial.write(Serial.read());
  }
}