Go Down

Topic: When the crash sensor is used it must send a sms. void setup (Read 1 time) previous topic - next topic

noelworpuz

void setup() {
  // initialize serial:
  Serial.begin(9600);
 // mySerial.begin(9600);
  while(!GSMTEST.init()) {
      delay(1000);
      Serial.print("GSM Error!\r\n");
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare Micro switch as input
  } 
  Serial.println("GSM Okay");
  Serial.println("System Starting");
  Serial.print("..");
  delay(1000);
  Serial.println(".....");
  delay(1000);
  // reserve 200 bytes for the inputString:
  inputString.reserve(200);
  Serial.println("GPS Ready");

  GSMTEST.sendSMS(PHONE_NUMBER,MESSAGE); //DEFINE PHONE NUMBER AND TEXT
}

void loop() {
valueCrash = digitalRead(inPin); // read the state of the crash sensor

digitalWrite(ledPin, !valueCrash); // light LED if switch closed
digitalWrite(ledPin, !GSMTEST.sendSMS(PHONE_NUMBER,"fk"); //DEFINE PHONE NUMBER AND TEXT);   

noelworpuz

void loop() {
valueCrash = digitalRead(inPin); // read the state of the crash sensor

digitalWrite(ledPin, !valueCrash); // light LED if switch closed
digitalWrite(ledPin, !GSMTEST.sendSMS(PHONE_NUMBER,"fk"); //DEFINE PHONE NUMBER AND TEXT);

And the sms won't stop texting me..
I want when the crash sensor is being used that is the only time it will send message.

AWOL

Don't you want to send a text when you detect a new event, not all the time an event is being detected? Take a look at the IDE's state change example.

Please remember to use code tags when posting code
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Go Up