How do I emit pulse from my ISR?

Here is my ISR :

struct State {


// define pin for metal detector
#define detect 9

// Set detect pin as inputs
pinMode(detect, INPUT);
digitalWrite(detect, LOW);

//------------------------------interrupt service routine pin3--------------------------
// Interrupt routine on pin 3 (Interrupt 1)runs if detect changes state
void detect_pin3(){
delay(1); // delay for Debouncing ?
Serial.print("Metal detected !!! ");
emitValue<output_OUT>(ctx, true);
//------------------------interrupt service routine pin3(above)------------------------

void evaluate(Context ctx) {
//auto inValue = getValue<input_IN>(ctx);
//emitValue<output_OUT>(ctx, inValue

if (isInputDirty<input_INIT>(ctx)){attachInterrupt(1,detect_pin3,CHANGE); return;}

  auto isEnabled = getValue<input_EN>(ctx);

if (!isEnabled){return;}

Would appreciate a response as this is needed in my “robo mower” project !!!

Just set the output pulse pin to true. For example, from "delay " node:

emitValue<output_DONE>(ctx, true);

FYI: putting in a delay(1) without re-checking the input value after will not provide “debounce”. You mention in another post that you need this to react quickly, so you probably can’t afford much time on debounce anyway…you will be off the metal when you go back to re-check input to see if it was a false-positive. There is a debounce node that you can use to filter input to your node, but unfortunately, it is an abstract type so you can’t easily view the code for it to copy into your own node (but XOD is about re-use and you should use the existing node for debounce instead of copying the code anyway).

Thanks for you quick response…the metal detector ISR is now working great !!!
Will send pictures of the SPIDER in action after more development.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.