8 years, 4 months ago.

multiple pins in PinDetect

Hi Using multiple pins in PinDetect how to know to define them properly? And how to know inside the callback function which pin triggered it?

I did like this:

PinDetect PINS[3]={p21,p22,p23};

and the I go in a loop setting them up:

PINS[ID].mode( PullUp ); PINS[ID].attach_asserted( &keyPressed); PINS[ID].attach_deasserted( &keyReleased ); PINS[ID].attach_asserted_held( &keyPressedHeld);

so when e.g. keyPressed is called how could I know which of PINS caused it?

Thank you!

Be the first to answer this question.