pin_interrupt_test.ino 1011 B

1234567891011121314151617181920212223242526272829303132
  1. // Search pins usable for endstop-interrupts
  2. // Compile with the same build settings you'd use for Marlin.
  3. #if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA)
  4. #undef digitalPinToPCICR
  5. #define digitalPinToPCICR(p) ( ((p) >= 10 && (p) <= 15) || \
  6. ((p) >= 50 && (p) <= 53) || \
  7. ((p) >= 62 && (p) <= 69) ? (&PCICR) : nullptr)
  8. #endif
  9. void setup() {
  10. Serial.begin(9600);
  11. Serial.println("PINs causing interrupts are:");
  12. for (int i = 2; i < NUM_DIGITAL_PINS; i++) {
  13. if (digitalPinToPCICR(i) || (int)digitalPinToInterrupt(i) != -1) {
  14. for (int j = 0; j < NUM_ANALOG_INPUTS; j++) {
  15. if (analogInputToDigitalPin(j) == i) {
  16. Serial.print('A');
  17. Serial.print(j);
  18. Serial.print(" = ");
  19. }
  20. }
  21. Serial.print('D');
  22. Serial.println(i);
  23. }
  24. }
  25. Serial.println("Arduino pin numbering!");
  26. }
  27. void loop() {
  28. // put your main code here, to run repeatedly:
  29. }