Mbed program getting an error on joystickcenter.rise(&flip)

#include “mbed.h”
#include “C12832.h”

InterruptIn joystickcenter(p14);
InterruptIn button(p9);
DigitalOut led(LED1);
DigitalOut flash(LED4);
int x;

void flip(int x=1) {
led = !led; // toggles the led when the joystick button is pressed.
}

int main() {
joystickcenter.rise(&flip); // attach the function address to the rising edge
button.mode(PullUp); // With this, no external pullup resistor needed
button.rise(&flip); // attach the function address to the rising edge
while(1) { // wait around, interrupts will interrupt this!
if(x==1){
lcd.locate(0.0);
lcd.printf(“Varialble SET!”);
flash = !flash; // turns LED4 on if off, off if on
wait(0.25); // the instruction to wait for a quarter-second
}
}
}
Getting an error on joystickcenter.rise(&flip); // attach the function address to the rising edge.
Its basic I know but just starting out, so would be grateful for any help. Thanks

Hi Brendan,

for publishing a code, please use

```
// your code
```

However this will be the problem

int x;

void flip(int x=1)){
// do something with x
}
//correct is 
volatile int x = 1;

void flip(){
// do something with x
}

The InterruptIn Api not contain any method where you can pass an address of function with parameters.

BR, Jan