Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino

32 lines
907 B
Arduino
Raw Normal View History

2017-05-20 20:30:36 -04:00
// Search pins usable for endstop-interrupts
// Compile with the same build settings you'd use for Marlin.
#if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA)
2019-10-30 16:52:02 -04:00
#define moreDigitalPinToPCICR(p) digitalPinToPCICR(WITHIN(p, 13, 14) ? 10 : p)
#else
#define moreDigitalPinToPCICR(p) digitalPinToPCICR(p)
#endif
void setup() {
Serial.begin(9600);
2017-11-20 00:00:43 -05:00
Serial.println("PINs causing interrupts are:");
2017-05-20 20:30:36 -04:00
for (int i = 2; i < NUM_DIGITAL_PINS; i++) {
2019-10-30 16:52:02 -04:00
if (moreDigitalPinToPCICR(i) || (int)digitalPinToInterrupt(i) != -1) {
2017-05-20 20:30:36 -04:00
for (int j = 0; j < NUM_ANALOG_INPUTS; j++) {
if (analogInputToDigitalPin(j) == i) {
Serial.print('A');
Serial.print(j);
Serial.print(" = ");
}
}
2017-05-20 20:30:36 -04:00
Serial.print('D');
Serial.println(i);
}
}
Serial.println("Arduino pin numbering!");
}
void loop() {
// put your main code here, to run repeatedly:
}