This repository has been archived on 2022-01-28. You can view files and clone it, but cannot push or open issues or pull requests.
Marlin-Artillery-M600/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino

33 lines
1,011 B
Arduino
Raw Permalink Normal View History

2017-05-21 02:30:36 +02: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)
#undef digitalPinToPCICR
#define digitalPinToPCICR(p) ( ((p) >= 10 && (p) <= 15) || \
((p) >= 50 && (p) <= 53) || \
((p) >= 62 && (p) <= 69) ? (&PCICR) : nullptr)
#endif
void setup() {
Serial.begin(9600);
2017-11-20 06:00:43 +01:00
Serial.println("PINs causing interrupts are:");
2017-05-21 02:30:36 +02:00
for (int i = 2; i < NUM_DIGITAL_PINS; i++) {
if (digitalPinToPCICR(i) || (int)digitalPinToInterrupt(i) != -1) {
2017-05-21 02:30:36 +02:00
for (int j = 0; j < NUM_ANALOG_INPUTS; j++) {
if (analogInputToDigitalPin(j) == i) {
Serial.print('A');
Serial.print(j);
Serial.print(" = ");
}
}
2017-05-21 02:30:36 +02:00
Serial.print('D');
Serial.println(i);
}
}
Serial.println("Arduino pin numbering!");
}
void loop() {
// put your main code here, to run repeatedly:
}