Serial communication happens only one time But next time the If loop executes then serial commands did not execute.
Code worked for 3 months but it stopped working on my machine suddenly please guide
char phone_no1[]="9860422730";
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
delay(400);
pinMode(13, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(8) == HIGH)
{
Serial.begin(9600);
delay(500);
Serial.print("AT+CMGF=1\r\n");
delay(3000);
Serial.print("AT+CMGS="");
Serial.print(phone_no1);// first number
Serial.print(""\r\n");
delay(3000);
Serial.print("hi");
Serial.write(0x1A);
Serial.write(0x0D);
Serial.write(0x0A);
Serial.print("\n");
delay(3000);
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(100);
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(100);
}
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000);// wait for a second
}