expected primary-expression before ')' token

Jan 26, 2016 at 7:51pm
im a beginner programmer in c++ and i am haveing this problem and dont know what to do.(last line)

http://puu.sh/mKElD/b58a377d02.png

the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "SIM900.h"
#include <SoftwareSerial.h>
char inchar; //Will hold the incoming character from the Serial Port.
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to send and receive SMS.

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

#define RELAY1  6

void setup() 
{
  //Serial connection.
  Serial.begin(9600);
  Serial.println("GSM Shield testing.");
  //Start configuration of shield with baudrate.
  //For http uses is raccomanded to use 4800 or slower.
  if (gsm.begin(2400)){
    Serial.println("\nstatus=READY");
    started=true;  
  }
  else Serial.println("\nstatus=IDLE");
  
  if(started){
    //Enable this two lines if you want to send an SMS.
    //if (sms.SendSMS("3471234567", "Arduino SMS"))
      //Serial.println("\nSMS sent OK");
  }

};

void loop()
{
  if(started){
    //Read if there are messages on SIM card and print them.
    if(gsm.readSMS(smsbuffer, 160, n, 20))
    {
      Serial.println(n);
      Serial.println(smsbuffer);
    }
    delay(1000);
  }
{
if(Serial.available()>0)
{
 (inchar=Serial.read());
 {
    if (inchar=='#'){
       delay(10);
       inchar=Serial.read();
       if (inchar=='a'){
        
delay(10);
          inchar=Serial.read();
          if (inchar=='0'){
            digitalWrite(RELAY1,LOW);           // Turns ON Relays 1

   delay(2000);                                      // Wait 2 seconds

   digitalWrite(RELAY1,HIGH);   // Turns Relay Off
}
Last edited on Jan 27, 2016 at 3:33pm
Jan 26, 2016 at 8:03pm
It's worth noting that the language used by the Arduino compiler is neither C nor C++.

You used parentheses instead of curly braces in at least two places.
Jan 27, 2016 at 7:52am
i changed the braces and im now getting this message

exit status 1
expected '}' at end of input


?????
Jan 27, 2016 at 11:28am
i changed the braces and im now getting this message
What braces?

At the end of loop() is at least one curly brace missing.

Please use code tags: [code]Your code[/code]
Read this: http://www.cplusplus.com/articles/z13hAqkS/

If you'd use a proper indention it would be easier to see where braces are missing.
Jan 27, 2016 at 3:34pm
like that??
Jan 27, 2016 at 3:45pm
Well, the last closing brace belongs to line 73. All braces above until including line 61 and 51 do not have a matching closing brace.

The opening brace on line 61/65 have no use whatsoever.
Jan 27, 2016 at 4:03pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "SIM900.h"
#include <SoftwareSerial.h>
char inchar; //Will hold the incoming character from the Serial Port.
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to send and receive SMS.

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

#define RELAY1  6

void setup()
{
  //Serial connection.
  Serial.begin(9600);
  Serial.println("GSM Shield testing.");
  //Start configuration of shield with baudrate.
  //For http uses is raccomanded to use 4800 or slower.
  if (gsm.begin(2400)){
    Serial.println("\nstatus=READY");
    started=true;  
  }
  else Serial.println("\nstatus=IDLE");
  
  if(started){
    //Enable this two lines if you want to send an SMS.
    //if (sms.SendSMS("3471234567", "Arduino SMS"))
      //Serial.println("\nSMS sent OK");
  }

};

void loop()
{
  if(started){
    //Read if there are messages on SIM card and print them.
    if(gsm.readSMS(smsbuffer, 160, n, 20))
    {
      Serial.println(n);
      Serial.println(smsbuffer);
    }
    delay(1000);
  }
if(Serial.available()>0)
{
 (inchar=Serial.read());
 
    if (inchar=='#'){
       delay(10);
       inchar=Serial.read();
       if (inchar=='a'){
        
delay(10);
          inchar=Serial.read();
          if (inchar=='0'){
            digitalWrite(RELAY1,LOW);           // Turns ON Relays 1

   delay(2000);                                      // Wait 2 seconds

   digitalWrite(RELAY1,HIGH);   // Turns Relay Off
}


and error:

GSM_GPRSLibrary_SMS:78: error: expected '}' at end of input

}

^

GSM_GPRSLibrary_SMS:78: error: expected '}' at end of input

GSM_GPRSLibrary_SMS:78: error: expected '}' at end of input

GSM_GPRSLibrary_SMS:78: error: expected '}' at end of input

exit status 1
expected '}' at end of input
Jan 27, 2016 at 4:07pm
Then add the missing braces after line 78. I can't do it for you.
Topic archived. No new replies allowed.