Here is my ISR :
struct State {
};
{{ GENERATED_CODE }}
// 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 !!!