attachInterrupt

How shall write the code to return a value in an interrupt "up".

void loop() {

attachInterrupt(0, up, FALLING);
attachInterrupt(1, down, FALLING);

....

void up()
{
detachInterrupt(0);
int value = +1;
}

menola

An ISR cannot return a value, you need to declare a global variable. Use the 'volatile' modifier and attempt to make all accesses to the variable atomic.

Example? url?

menola

volatile int i; // This is a global variable declared with the volatile modifier

void setup() {}
void loop() {}

hehe of corse!