Hello,
I want to read a SMS i send to my gsm shield and then depend on what i send i want arduino to do something.
here is the code:
#include <SoftwareSerial.h>
SoftwareSerial SIM900(2, 3);
char incoming_char=0;
void setup()
{
Serial.begin(19200); // for serial monitor
SIM900.begin(19200); // for GSM shield
SIM900power(); // turn on shield
delay(20000); // give time to log on to network.
SIM900.print("AT+CMGF=1\r"); // set SMS mode to text
delay(100);
SIM900.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 SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(7000);
Serial.println("Start...");
}
void loop()
{
if(SIM900.available() >0)
{
incoming_char=SIM900.read();
Serial.print(incoming_char);
if (incoming_char.compareTo("1")){
//something
}
}
}
after reading the incoming_char i want to compare it to "1".
this is the error i get:
sketch_apr07a.ino:39:23: error: request for member 'compareTo' in 'incoming_char', which is of non-class type 'char'
does anybody ever encounter this?
thanks!
Etay.