Error programming

Hello all,
I faced some problems in this code,there errors and I don't know where,can someone help me please?
Thank you in advance.

This is the code:

#include<SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);

const int error1 = 2;                                  // Input D2 named error1
const int error2 = 3;                                  
const int error3 = 4;                                  
const int error4 = 5;                                  
const int error5 = 6;     
const int error6 = 10;                                  
const int error7 = 11;                                  
const int error8 = 12;
const int error9 = 13;

int SMS_error1 = 0;                                    // Variable for reading error1
int SMS_error2 = 0;                                    
int SMS_error3 = 0;                                    
int SMS_error4 = 0;                                    
int SMS_error5 = 0;  
int SMS_error6 = 0;                                    
int SMS_error7 = 0;                                    
int SMS_error8 = 0;                                    
int SMS_error9 = 0;  

void setup() 
{ 
  pinMode(error1, INPUT);                              // Initialize error1 pin as an input
  pinMode(error2, INPUT);                             
  pinMode(error3, INPUT);                              
  pinMode(error4, INPUT);                              
  pinMode(error5, INPUT);   
  pinMode(error6, INPUT);                              // Initialize error1 pin as an input
  pinMode(error7, INPUT);                             
  pinMode(error8, INPUT);                              
  pinMode(error9, INPUT);   
  
  // activate GSM Sheild
  SIM900.begin(19200);                                 // Start the exchange between GSM Sheild and arduino Uno by speed of 19200 baud
  SIM900power();                                       // Wake up the GSM Sheild
  delay(20000);                                        // Give time to log on to network
}

void SIM900power(){   
// Software equivalent of pressing the GSM shield "power" button  
  digitalWrite(9 ,HIGH); 
  delay(1000);
  digitalWrite(9 ,LOW);
  delay(5000); 
}

void loop() 
{
  SMS_error1 = digitalRead(error1);                    // Reading of the input error1 and put it in SMS_error1
  SMS_error2 = digitalRead(error2);                   
  SMS_error3 = digitalRead(error3);                 
  SMS_error4 = digitalRead(error4);                    
  SMS_error5 = digitalRead(error5);                   
  SMS_error6 = digitalRead(error6);                   
  SMS_error7 = digitalRead(error7);                 
  SMS_error8 = digitalRead(error8);                    
  SMS_error9 = digitalRead(error9);
  
  if(SMS_error1 == HIGH) 
  {
    SendSMS_error1();
    do{} while{};
  }
  if(SMS_error2 == HIGH) 
  {
    SendSMS_error2();
    do{} while{1};
  }
  if(SMS_error3 == HIGH) 
  {
    SendSMS_error3();
    do{} while{1};
  }
  if(SMS_error4 == HIGH)
  {
    SendSMS_error4();
    do{} while{1};
  }
  if(SMS_error5 == HIGH) 
  {
    SendSMS_error5();
    do{} while{1};
  }
  if(SMS_error6 == HIGH) 
  {
    SendSMS_error6();
    do{} while{1};
  }
  if(SMS_error7 == HIGH) 
  {
    SendSMS_error7();
    do{} while{1};
  }
  if(SMS_error8 == HIGH) 
  {
    SendSMS_error8();
    do{} while{1};
  }
  if(SMS_error9 == HIGH)
  {
    SendSMS_error9();
    do{} while{1};
  }

}
  
void SendSMS_error1()
{
  SIM900.print("AT+CMGF=1\r");                         // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+2126xxxxxxxx\"");     // recipient's mobile number
  delay(100);
  SIM900.println("Station 85: error 1");                 // message to send
  delay(100);
  SIM900.println((char)26);                            // End AT command with a ^Z, ASCII code 26
  delay(100);  
  SIM900.println();
  delay(5000);                                         // give module time to send SMS
  SIM900power();
}

void SendSMS_error2() 
{
  SIM900.print("AT+CMGF=1\r");                         
  delay(100);
  SIM900.println("AT + CMGS = \"+2126xxxxxxxxx\"");     
  delay(100);
  SIM900.println("Station 85: error 2");                 
  delay(100);
  SIM900.println((char)26);                            
  delay(100); 
  SIM900.println();
  delay(5000);                                        
  SIM900power();
}

void SendSMS_error3()
{
  SIM900.print("AT+CMGF=1\r");                         
  delay(100);
  SIM900.println("AT + CMGS = \"+2126xxxxxxx\"");     
  delay(100);
  SIM900.println("Station 85: error 3");        
  delay(100);
  SIM900.println((char)26);                       
  delay(100); 
  SIM900.println();
  delay(5000);                                     
  SIM900power();
}  

void SendSMS_error4()
{
  SIM900.print("AT+CMGF=1\r");                         
  delay(100);
  SIM900.println("AT + CMGS = \"+2126xxxxxxxxx\"");     
  delay(100);
  SIM900.println("Station 85: error 4");        
  delay(100);
  SIM900.println((char)26);                       
  delay(100); 
  SIM900.println();
  delay(5000);                                     
  SIM900power();
}

void SendSMS_error5() 
{
  SIM900.print("AT+CMGF=1\r");                         
  delay(100);
  SIM900.println("AT + CMGS = \"+2126xxxxxxxx\"");     
  delay(100);
  SIM900.println("Station 85: error 5");        
  delay(100);
  SIM900.println((char)26);                       
  delay(100); 
  SIM900.println();
  delay(5000);                                     
  SIM900power();
}

void SendSMS_error6() 
{
  SIM900.print("AT+CMGF=1\r");                         // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+2126xxxxxxxx\"");     // recipient's mobile number
  delay(100);
  SIM900.println("Station 85: error 6");                 // message to send
  delay(100);
  SIM900.println((char)26);                            // End AT command with a ^Z, ASCII code 26
  delay(100);  
  SIM900.println();
  delay(5000);                                         // give module time to send SMS
  SIM900power();
}

void SendSMS_error7() 
{
  SIM900.print("AT+CMGF=1\r");                         // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+2126xxxxxxxx\"");     // recipient's mobile number
  delay(100);
  SIM900.println("Station 85: error 7");                 // message to send
  delay(100);
  SIM900.println((char)26);                            // End AT command with a ^Z, ASCII code 26
  delay(100);  
  SIM900.println();
  delay(5000);                                         // give module time to send SMS
  SIM900power();
}

void SendSMS_error8() 
{
  SIM900.print("AT+CMGF=1\r");                         // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+2126xxxxxxx\"");     // recipient's mobile number
  delay(100);
  SIM900.println("Station 85: error 8");                 // message to send
  delay(100);
  SIM900.println((char)26);                            // End AT command with a ^Z, ASCII code 26
  delay(100);  
  SIM900.println();
  delay(5000);                                         // give module time to send SMS
  SIM900power();
}

void SendSMS_error9()
{
  SIM900.print("AT+CMGF=1\r");                         // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+2126xxxxxxxx\"");     // recipient's mobile number, 
  delay(100);
  SIM900.println("Station 85: error 9");                 // message to send
  delay(100);
  SIM900.println((char)26);                            // End AT command with a ^Z, ASCII code 26
  delay(100);  
  SIM900.println();
  delay(5000);                                         // give module time to send SMS
  SIM900power();
}

As an error message,they tell me :
gestion_d_astriente.ino: In function 'void loop()':
gestion_d_astriente.ino:66:15: error: expected '(' before '{' token
gestion_d_astriente.ino:66:15: error: expected primary-expression before '{' token
gestion_d_astriente.ino:66:15: error: expected ')' before '{' token
gestion_d_astriente.ino:66:15: error: expected ';' before '{' token
gestion_d_astriente.ino:71:15: error: expected '(' before '{' token
gestion_d_astriente.ino:71:15: error: expected primary-expression before '{' token
gestion_d_astriente.ino:71:15: error: expected ')' before '{' token
gestion_d_astriente.ino:71:15: error: expected ';' before '{' token
gestion_d_astriente.ino:71:17: error: expected ';' before '}' token
gestion_d_astriente.ino:76:15: error: expected '(' before '{' token
gestion_d_astriente.ino:76:15: error: expected primary-expression before '{' token
gestion_d_astriente.ino:76:15: error: expected ')' before '{' token
gestion_d_astriente.ino:76:15: error: expected ';' before '{' token
gestion_d_astriente.ino:76:17: error: expected ';' before '}' token
gestion_d_astriente.ino:81:15: error: expected '(' before '{' token
gestion_d_astriente.ino:81:15: error: expected primary-expression before '{' token
gestion_d_astriente.ino:81:15: error: expected ')' before '{' token
gestion_d_astriente.ino:81:15: error: expected ';' before '{' token
gestion_d_astriente.ino:81:17: error: expected ';' before '}' token
gestion_d_astriente.ino:86:15: error: expected '(' before '{' token
gestion_d_astriente.ino:86:15: error: expected primary-expression before '{' token
gestion_d_astriente.ino:86:15: error: expected ')' before '{' token
gestion_d_astriente.ino:86:15: error: expected ';' before '{' token
gestion_d_astriente.ino:86:17: error: expected ';' before '}' token
gestion_d_astriente.ino:91:15: error: expected '(' before '{' token
gestion_d_astriente.ino:91:15: error: expected primary-expression before '{' token
gestion_d_astriente.ino:91:15: error: expected ')' before '{' token
gestion_d_astriente.ino:91:15: error: expected ';' before '{' token
gestion_d_astriente.ino:91:17: error: expected ';' before '}' token
gestion_d_astriente.ino:96:15: error: expected '(' before '{' token
gestion_d_astriente.ino:96:15: error: expected primary-expression before '{' token
gestion_d_astriente.ino:96:15: error: expected ')' before '{' token
gestion_d_astriente.ino:96:15: error: expected ';' before '{' token
gestion_d_astriente.ino:96:17: error: expected ';' before '}' token
gestion_d_astriente.ino:101:15: error: expected '(' before '{' token
gestion_d_astriente.ino:101:15: error: expected primary-expression before '{' token
gestion_d_astriente.ino:101:15: error: expected ')' before '{' token
gestion_d_astriente.ino:101:15: error: expected ';' before '{' token
gestion_d_astriente.ino:101:17: error: expected ';' before '}' token
gestion_d_astriente.ino:106:15: error: expected '(' before '{' token
gestion_d_astriente.ino:106:15: error: expected primary-expression before '{' token
gestion_d_astriente.ino:106:15: error: expected ')' before '{' token
gestion_d_astriente.ino:106:15: error: expected ';' before '{' token
gestion_d_astriente.ino:106:17: error: expected ';' before '}' token
Erreur lors de la compilation.

    do{} while{};

Do what while what?

http://arduino.cc/en/Reference/DoWhile

to send the SMS for one time

see reply #2

    do {} while {};

While what? Oops, duplicate...

dear AWOL,

I used it to send the SMS just for one time

See reply #5

Dear aarg,
I used the same condition in this code,and it's working.

#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);
 
void setup()
{
  SIM900.begin(19200);
  SIM900power();  
  delay(20000);  // give time to log on to network. 
}
 
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
}
 
void sendSMS()
{
  SIM900.print("AT+CMGF=1\r");                         // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+2126xxxxx\"");     // recipient's mobile number
  delay(100);
  SIM900.println("Hello Tariq, This is your Arduino");        // message to send
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100); 
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  SIM900power();                                   // turn off module
}
 
void loop()
{
  sendSMS();
  do {} while (1);
}

The same condition?

Yes the same condition,just in the first code,I used some other conditions to send a different SMS for each HIGHest Input

Kricky,

do {} while {};

is a syntax error. Look at it closely.

Really, you don't need to look that closely

ok, but how can I send the SMS for one time.
Example:

if D2==HIGH ==> send SMS1 (just for 1 time)
if D2==LOW and after few time become HIGH ==> send SMS1(just for 1 time)

did you understand what I want?
Thank you

Yes, I understand what you want

ok,is there a solution?

AWOL:
Really, you don't need to look that closely

When you see a lot of mistakes all at once, your vision can go all fuzzy. :slight_smile: Kind of like trying to find that screw that you dropped on the speckled beige tweed carpet.

krikho1994:
ok,is there a solution?

Yes, use a variable to signify sent/unsent status.

speckled beige tweed carpet

That's not bad programming, that's simply bad taste