Jump to content
43oh

required primary expression


Recommended Posts

hi

i am getting the error as

Average_New.cpp: In function 'void setup()':
Average_New.cpp:9:35: error: expected primary-expression before 'int'

 

the code is as follows:

 

void setup()
{
Serial.begin(9600);
pinMode(GREEN_LED, OUTPUT);
pinMode(RED_LED, OUTPUT);
pinMode(PUSH2, INPUT_PULLUP);
attachInterrupt(PUSH2,  calibrate(int maxvalue), FALLING);
}

 

void calibrate(int maxValue)
{
  if(maxValue<threshold)
  maxValue=threshold;
}
 

 

how to solve this problem?? what is mean by primary expression?

Link to post
Share on other sites

simple:

attachInterrupt(PUSH2,  calibrate(int maxvalue), FALLING);

                                                            /\ 

                                                     why do you have a function prototype here? it should just be "calibrate"

Link to post
Share on other sites

if i put only function name:

 

attachInterrupt(PUSH2,  calibrate, FALLING);

 

then it is showing this error:

Average_New.cpp: In function 'void setup()':
Average_New.cpp:9:43: error: invalid conversion from 'void (*)(int)' to 'void (*)()' [-fpermissive]
C:\ti\energia-0101E0016-windows\energia-0101E0016\hardware\msp430\cores\msp430/Energia.h:212:6: error:   initializing argument 2 of 'void attachInterrupt(uint8_t, void (*)(), int)' [-fpermissive]
 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...