#if ! ( defined __AVR_ATmega2560__ || defined __AVR_ATmega1280__ || defined __AVR_ATmega1281__ || defined __AVR_ATmega2561__ || defined __AVR_ATmega640__ ) #error "This sketch only works on chips in the ATmega2560 family." #endif // PIN NAMING // For the Analog Input pins used as digital input pins, you can call them 14, 15, 16, etc. // or you can use A0, A1, A2, etc. (the Arduino code will properly recognize the symbolic names, // for example, pinMode(A0, INPUT_PULLUP); // For Arduino MEGA (AT2560-based), besides the regular pins and the A (analog) pins, // you have 4 more pins with defined names: // SS = 53 // MOSI = 51 // MISO = 50 // SCK = 52 // NOW CHOOSE PINS #define FIRST_ANALOG_PIN 54 #define TOTAL_PINS 69 //97 // 69 // But only 18 of them (not including RX0) are PinChangeInt-compatible // Don't use RX0 (Arduino pin 0) in this program- it won't work this is the // pin that Serial.print() uses! // See the Arduino and the chip documentation for more details. #define MYPIN1 ROTTARY_SW_clk // ROTTARY_SW_sw // ROTTARY_SW_sw // SS #define MYPIN2 ROTTARY_SW_dt // SCK #define MYPIN3 ROTTARY_SW_sw // A8 //ROTTARY_SW_sw // MOSI #define PIN3TEXT "ROTTARY_SW_sw " // This will say what MYPIN3 is, on the serial monitor volatile uint8_t latest_interrupted_pin; volatile uint8_t interrupt_count[TOTAL_PINS]={0}; // possible arduino pins volatile uint8_t pin3Count=0; /* volatile unsigned int encoder0Pos = 0; static boolean rotating = false; */