Arduino_EMBRYO_2 - prepareInterrupt()

Attaches to interrupt pins of the start and emergency stop buttons.

Syntax

axis.prepareInterrupt()

Example

#include <Arduino_EMBRYO_2.h>

StepMotor axis(1, A5, 5, 6, 3, 4, A2, A1, 2, 12);

void setup() {
  Serial.begin(9600);
  while (!Serial) {};
  axis.begin();
  terminateInterrupt();  // Detach the interrupt pins
  prepareInterrupt();  // Attach the interrupt pins
}
void loop() {
  if(axis.readBtnForward()) axis.moveForward();
  if(axis.readBtnBackward()) axis.moveBackward();
}

See also