Hello together,
i want to send me a SMS with a button click. The problem is that even if the circuit is not closed, the program gets into the IF, even when there is no HIGH at the INPUT. I am also using a drop down but it doesn't change anything. Where is the problem ? Can somebody please help me ?
Here is my Sketch :
#include <GSM.h>
#define PINNUMBER "6915"
GSM gsmAccess;
GSM_SMS sms;
void setup()
{
Serial.begin(9600);
Serial.println("SMS Messages Sender");
pinMode(8,OUTPUT);
pinMode(4,INPUT);
char nummer[20];
char Alarm[200];
boolean notConnected = true;
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("GSM initialized");
}
void loop()
{
digitalWrite(8,HIGH);
if(digitalRead(4)==HIGH)
{
Serial.println("Achtung Sendung in 30s");
delay(30000);
sms.beginSMS("0157XXXXXXX");
sms.print("Alarm");
sms.endSMS();
digitalWrite(4,LOW);
}
}