hello all,
i faced problems in code,there errors , don't know where,can me please?
thank in advance.
this code:
i faced problems in code,there errors , don't know where,can me please?
thank in advance.
this code:
code: [select]
#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 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 input
pinmode(error2, input);
pinmode(error3, input);
pinmode(error4, input);
pinmode(error5, input);
pinmode(error6, input); // initialize error1 pin input
pinmode(error7, input);
pinmode(error8, input);
pinmode(error9, input);
// activate gsm sheild
sim900.begin(19200); // start exchange between gsm sheild , arduino uno speed of 19200 baud
sim900power(); // wake gsm sheild
delay(20000); // give time log on network
}
void sim900power(){
// software equivalent of pressing gsm shield "power" button
digitalwrite(9 ,high);
delay(1000);
digitalwrite(9 ,low);
delay(5000);
}
void loop()
{
sms_error1 = digitalread(error1); // reading of input error1 , put 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"); // @ command send sms message
delay(100);
sim900.println("at + cmgs = \"+2126xxxxxxxx\""); // recipient's mobile number
delay(100);
sim900.println("station 85: error 1"); // message send
delay(100);
sim900.println((char)26); // end @ command ^z, ascii code 26
delay(100);
sim900.println();
delay(5000); // give module time 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"); // @ command send sms message
delay(100);
sim900.println("at + cmgs = \"+2126xxxxxxxx\""); // recipient's mobile number
delay(100);
sim900.println("station 85: error 6"); // message send
delay(100);
sim900.println((char)26); // end @ command ^z, ascii code 26
delay(100);
sim900.println();
delay(5000); // give module time send sms
sim900power();
}
void sendsms_error7()
{
sim900.print("at+cmgf=1\r"); // @ command send sms message
delay(100);
sim900.println("at + cmgs = \"+2126xxxxxxxx\""); // recipient's mobile number
delay(100);
sim900.println("station 85: error 7"); // message send
delay(100);
sim900.println((char)26); // end @ command ^z, ascii code 26
delay(100);
sim900.println();
delay(5000); // give module time send sms
sim900power();
}
void sendsms_error8()
{
sim900.print("at+cmgf=1\r"); // @ command send sms message
delay(100);
sim900.println("at + cmgs = \"+2126xxxxxxx\""); // recipient's mobile number
delay(100);
sim900.println("station 85: error 8"); // message send
delay(100);
sim900.println((char)26); // end @ command ^z, ascii code 26
delay(100);
sim900.println();
delay(5000); // give module time send sms
sim900power();
}
void sendsms_error9()
{
sim900.print("at+cmgf=1\r"); // @ command send sms message
delay(100);
sim900.println("at + cmgs = \"+2126xxxxxxxx\""); // recipient's mobile number,
delay(100);
sim900.println("station 85: error 9"); // message send
delay(100);
sim900.println((char)26); // end @ command ^z, ascii code 26
delay(100);
sim900.println();
delay(5000); // give module time send sms
sim900power();
}
as 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.
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.
Arduino Forum > Using Arduino > Programming Questions > Error programming
arduino
Comments
Post a Comment