#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 8);
char incoming_char=0;
void setup()
{
Serial.begin(19200); // for serial monitor
mySerial.begin(19200); // for GSM shield
mySerial.print("AT+CMGF=1\r"); // set SMS mode to text
delay(100);
mySerial.print("AT+CNMI=2,2,0,0,0\r");
// blurt out contents of new SMS upon receipt to the GSM shield's serial out
delay(100);
}
void loop()
{
// Now we simply display any text that the GSM shield sends out on the serial monitor
if(mySerial.available() >0)
{
incoming_char=mySerial.read(); //Get the character from the cellular serial port.
Serial.print(incoming_char); //Print the incoming character to the terminal.
}
}
No hay comentarios:
Publicar un comentario