arduinoarduino-due

How to edit library to use with Arduino DUE?


I want to add Arduino DUE in this code.

// Arduino Uno, Duemilanove, LilyPad, etc
//
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
 #define ALTSS_USE_TIMER1
 #define INPUT_CAPTURE_PIN       8 // receive
 #define OUTPUT_COMPARE_A_PIN        9 // transmit
 #define OUTPUT_COMPARE_B_PIN       10 // unusable PWM

Code from library


Solution

  • The preprocessor for the Arduino Due is __SAM3X8E__. For example:

    // Arduino Uno, Duemilanove, LilyPad, etc
    //
    #elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
     #define ALTSS_USE_TIMER1
     #define INPUT_CAPTURE_PIN       8 // receive
     #define OUTPUT_COMPARE_A_PIN        9 // transmit
     #define OUTPUT_COMPARE_B_PIN       10 // unusable PWM
    //
    // Arduino Due
    // 
    #elif defined(__SAM3X8E__)
    // define or do your stuff