Multiswitch de Robbe y Arduino.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pedro gomez
    • Sep 2007
    • 91

    #31
    Hi Tim:
    I tried to compile your sketch and IDE show this:
    PCintPort has not been declared..in this line

    " PCintPort::attachInterrupt(SERVO_IN_PIN, calcServo, CHANGE);"

    I've change the line to only "attachInterrupt(SERVO_IN_PIN, calcServo, CHANGE);" and the compilation is finished.

    Well I'm trying to simplify your sketch to only have the results of 9 signals, control signal + eight (multiswitch 12 ints +2 pots) because I use it to polarize TIP122 transistors and do things. Also move servos, but isn't usually.

    What do you think.......:::::

    #include <PinChangeInt.h>
    #define SERVO_IN_PIN 10
    volatile unsigned long ulServoInShared= 0;
    volatile unsigned long ulServoStart = 0;
    volatile int multi_servo[17];
    volatile int current_servo = 0;

    void setup()
    {
    Serial.begin(9600); // other values include 9600, 14400, 57600 etc.

    // set up interrupt for receiver input
    attachInterrupt(SERVO_IN_PIN, calcServo, CHANGE);

    }

    void loop()
    {
    int servonum = 0;
    int servoval = 360;
    float tempval = 360.0;

    // array slot zero is sync - 1 thru 9 are valid servo pulses
    for (servonum = 1; servonum < 9; servonum++)
    {
    Serial.print("Servo: ");
    Serial.print(servonum);
    Serial.print(", ");
    Serial.println(multi_servo[servonum]);
    }

    // "if...multi_servo[servonum] = > < xxx" conditions to do things

    }


    void calcServo()
    {
    if (digitalRead(SERVO_IN_PIN) == HIGH)
    {
    ulServoStart = micros();
    }
    else
    {
    ulServoInShared = (uint16_t)(micros() - ulServoStart);
    current_servo++;

    if (ulServoInShared < 1000) {
    current_servo = 0;
    }

    if (ulServoInShared > 2000) {
    current_servo = 0;
    }

    if (current_servo < 10) {
    multi_servo[current_servo] = ulServoInShared;
    }
    }
    }



    Another Question: in a Arduino UNO I must change "#define SERVO_IN_PIN 10" to #define SERVO_IN_PIN 2" or "#define SERVO_IN_PIN 3"??
    I read interrups in UNO must use 2 or 3 pin.



    Thanks
    Best Regards

    Pedro

    Comment

    • tsenecal

      #32
      Pedro,

      the line you changed "PCintPort::attachInterrupt..." is the line that allowed me to use pin 10.

      it is allowed because of the line "#include <PinChangeInt.h>"

      PinChangeInt is a library that i thought was included as part of the basic arduino install, but have discovered it isn't. you will have to download the zip file from https://github.com/GreyGnome/PinChangeInt

      and then install the library

      if you don't use the library, and continue to use the standard attachInterrupt, then yes, you will need to change the pin from 10 to 2 or 3.

      if you don't use the library, you can also get rid of the "#include <PinChangeInt.h>" line.


      please note, if you do decide to use the "attachInterrupt" function, it is not the pin # that you pass as the first argument, but the interrupt # you pass as the first argument. in 99% of all cases, the pin and the interrupt do not align, and you will want to use the function digitalPinToInterrupt(pin) to get the interrupt that the specific pin aligns with.

      Code:
      #define SERVO_IN_PIN 3
      
      void setup(){
        attachInterrupt(digitalPinToInterrupt(SERVO_IN_PIN), calcServo, CHANGE);
      }
      in addition to all that, it appears that the digitalPinToInterrupt function is not defined for all models of the arduino in earlier versions of the arduino IDE, so you will want to make sure you are running the newest version of the arduino IDE.


      and last but not least, it appears that the PinChangeInt library has now been upgraded to a newer library named EnableInterrupt.... so, it looks like i will need to check out that library, and post a new sketch that shows how to do this with that library. It will benefit us to move to the new library, the new library has less overhead, which means good things.

      Comment

      • pedro gomez
        • Sep 2007
        • 91

        #33
        Hi Tim:
        Ufff, all this is getting enough complicated for my current level of Arduino,
        I need learn more to improve .... I need to use Multiswitch without problems.

        What is the advantage of using the library <PinChangeInt.h>, instead of using what I read in RCArduino:

        #define ch7_interrupt 0 //INTERRUPT 0 = PIN DIGITAL 2 / DIGITAL SWITCH 1 = PIN 3.
        #define ch7 2 // 0 = DIGITAL SWITCH PIN 2

        and

        attachInterrupt(ch7_interrupt,calcInput,CHANGE);

        and

        void calcInput()

        ....

        restricted the use of pins 2 and 3 ??
        It is faster??
        It allows you to use more than two interruptions at any pin?


        Best Regards
        Pedro

        Comment

        • tsenecal

          #34
          Pedro,

          the only advantage that PinChangeInt has is the use of more than just interrupt 0 and interrupt 1 (pins 2 & 3 on the UNO ).

          if you switch to PinChangeInt, the UNO can supposedly use an interrupt with any pin (actually a total of 24 pins are available ) you would not be limited to pins 2 & 3.

          there is a second benefit as well, there is no mapping between pins and interrupts. with PinChangeInt, you will use the pin number always... so only one define is used in the code.

          it isn't noticeably faster than attachInterrupt.

          no interrupt service allows for more than one interrupt per pin at any given time.


          I use PinChangeInt because i have standardized on the arduino micro and sparkfun pro micro for my boards, they use a different atmega processor that is basically restricted to interrupt 7 with attachInterrupt, but has 8 pins available using PinChangeInt. 8 is much better than 1.


          Tim

          Comment

          • pedro gomez
            • Sep 2007
            • 91

            #35
            Hi Tim:
            Thanks.
            Do you have read with PinChangeInt, more than one channels in the sketch?. In The sketch I'm working, I need read the special channel of multiswitch and two normal channels more. And I have another project wich need read two multiswitch channels and other normal channels.
            I tested your sketch yesterday and it runs faster and without problems. Tomorrow I'll try apply my "if" conditions and servos.

            Pedro

            Comment

            • tsenecal

              #36
              Originally posted by pedro gómez View Post
              Hi Tim:
              Thanks.
              Do you have read with PinChangeInt, more than one channels in the sketch?. In The sketch I'm working, I need read the special channel of multiswitch and two normal channels more. And I have another project wich need read two multiswitch channels and other normal channels.
              I tested your sketch yesterday and it runs faster and without problems. Tomorrow I'll try apply my "if" conditions and servos.

              Pedro
              Pedro,

              glad to hear that the sketch works for you.

              yes, with your UNO, you could very easily handle all that you speak of. for the Uno, using PinChangeInt would allow you to read every single individual channel on an 8 channel receiver, including 3 multi-switch channels (the maximum available on an F-14 robbe setup). you would need individual calcServo functions and associated variables for each channel you wish to read.

              Comment

              • pedro gomez
                • Sep 2007
                • 91

                #37
                Tim:
                GREAT!!!
                I will work on sketches that I need, and once I have tested them, I'll notice to the forum for those who want to improve the performance of its submarines with Arduino. So they will not have to waste so much time as I spent trying to make things work with pulseIn.
                As I go on trying, if I find a problem, I'll comment you on this thread
                TYVM
                Pedro

                Comment

                • pedro gomez
                  • Sep 2007
                  • 91

                  #38
                  Hi Tim:

                  This is my code for the Marlin:

                  Without your help this would not have been possible!!!! Thanks a lot!!!!

                  I hope will serve help or give ideas for someone

                  I hope this





                  code:::




                  //Marlin SST-2 con <PinChangeInt.h>. Original idea from Tim Senecal, performed by Pedro Gómez 2/28/2016
                  //Battery LiPo 3C 5000mA 20C Turnigy. ESC Turnigy with reverse running by relay. BEC.
                  //Multiswitch Robbe 12+2 in ch7 to Arduino for: Torpedo, lights 1 y 2, gadgets with servos 360Āŗperisc, sonar, radar).
                  //ch5 forward planes (retractable planes)
                  //ch2 control rolling pump with Robbe Duoswitch
                  //ON OFF Bluetooth Blueterm
                  //Failsafes Lost Signal Radio,by pulseIn, flooding an voltage level.

                  #include <Servo.h>
                  #include <PinChangeInt.h>

                  #define Ch7 2 // Multiswitch 12+2
                  volatile unsigned long ulPulseInSharedCh7 = 0;
                  volatile unsigned long ulPulseStartCh7 = 0;
                  volatile int multi_switch[9];
                  volatile int current_switch = 0;

                  #define Ch5 3 // Forward Planes
                  volatile unsigned long ulPulseInSharedCh5 = 0;
                  volatile unsigned long ulPulseStartCh5 = 0;

                  #define Ch2 4 // Rolling pump
                  volatile unsigned long ulPulseInSharedCh2 = 0;
                  volatile unsigned long ulPulseStartCh2 = 0;


                  char blueToothVal; //value sent over via bluetooth
                  int power = 18; // switcher Bluetooth.

                  Servo Radar; // 7, servo rotacion 360Āŗ
                  Servo Sonar; // 12, servo rotacion 360Āŗ
                  Servo Periscopio; // 10, servo rotacion 360Āŗ
                  int inversor = 5; // output to transistor TIP122 and relay for reverse running.
                  int luces1 = 13; // leds
                  int luces2 = 16; // leds
                  int T_los = 17; // output to TIP122 & torpedo solenoid valve
                  int pos_tpp; // forward planes
                  Servo Desplegar; // 9 retractable servo
                  int pos; // slow retractable maneuver
                  Servo TPP; // 6

                  int bombear; // rolling pump
                  Servo Peristaltic;// 11, to Duoswitch (or ESC).

                  int signalRC;
                  int sumergido = 8;
                  int inundado = 14;
                  int estado_S_I = 8;// digital input from surface sensor BUK455, HIGH is surface, LOW is deep
                  int flood = 14; // leaks sensor BUK455. HIGH is leak
                  int alarm = 15 ; // output to TIP122 for buzzer.
                  int Checker_LiPo = 19; // from checker_LiPo buzzer

                  void setup()
                  {
                  Serial.begin(9600); // other values include 9600, 14400, 57600 etc.

                  PCintPort::attachInterrupt(Ch7, calcPulseCh7, CHANGE); // set up interrupt for receiver inputs
                  PCintPort::attachInterrupt(Ch5, calcPulseCh5, CHANGE); // set up interrupt for receiver inputs
                  PCintPort::attachInterrupt(Ch2, calcPulseCh2, CHANGE); // set up interrupt for receiver inputs

                  pinMode(18,OUTPUT); // TIP y rele Bluetooth

                  Radar.attach(7); // servo 360Āŗ
                  Sonar.attach(12); // servo 360Āŗ
                  Periscopio.attach(10); // servo 360Āŗ
                  pinMode(5,OUTPUT); // TIP122 for reverse running

                  TPP.attach(6); // servo FORWARD planes
                  Desplegar.attach(9); // servo retractable servo for forward planes

                  Peristaltic.attach(11); // signal to Rolling Pump by Duoswitch or ESC

                  pinMode(13,OUTPUT); // Leds1
                  pinMode(16,OUTPUT); // Leds2
                  pinMode(17,OUTPUT); // TIP 122 to solenoid valve for fire torpedo

                  pinMode(8,INPUT); // signal sensor S-I.
                  pinMode(14,INPUT); // sensor leak
                  pinMode(15,OUTPUT); // alarm buzzer
                  pinMode(19,INPUT); // checker _LiPo
                  }

                  void loop()
                  {
                  //
                  // Switcher bluetooth
                  //
                  if(Serial.available()) //if there is data being received
                  {
                  blueToothVal=Serial.read(); //read it
                  }
                  if (blueToothVal=='1') //
                  {
                  digitalWrite(power,HIGH); // ON
                  Serial.println(" =SST-2 is on."); //
                  }
                  else if (blueToothVal=='0') //
                  {
                  digitalWrite(power,LOW); // OFF
                  Serial.println(" =SST-2 is off."); //
                  }
                  //
                  // Failsafes
                  // Lost signal radio on Deep.
                  //
                  signalRC = pulseIn(Ch2, HIGH);
                  Serial.print("signalRC= ");
                  Serial.println(signalRC);
                  sumergido = digitalRead(estado_S_I);

                  if ((signalRC == 0) && (sumergido == HIGH))
                  {
                  Peristaltic.writeMicroseconds(1088);
                  delay(2000);// loop
                  Peristaltic.writeMicroseconds(1088);//
                  }

                  //
                  // leaks on surface: alarm buzzer
                  //
                  inundado = digitalRead(flood);
                  if ((inundado == HIGH) && (sumergido == LOW))
                  {
                  digitalWrite (alarm,HIGH);
                  delay(2000);// loop alarm 2 sg
                  digitalWrite (alarm,LOW);
                  Peristaltic.writeMicroseconds(1500); // STOP Rolling Pump
                  Serial.println(" Inundacion!!!"); // To bluetherm to martphone
                  }
                  if ((inundado == LOW) && (sumergido == LOW))
                  {
                  digitalWrite (alarm,LOW); //
                  }
                  //
                  //leaks on deep: blow ballas rolling pump to surface.
                  //
                  if ((inundado == HIGH) && (sumergido == HIGH)) //
                  {
                  Peristaltic.writeMicroseconds(1088);
                  delay(2000);// loop
                  Peristaltic.writeMicroseconds(1088);//
                  }
                  //
                  // Batteries, Bluetooth al smartphone. Checker_LiPo
                  //
                  digitalRead(Checker_LiPo);
                  if ((Checker_LiPo == HIGH) && (sumergido == LOW)) //
                  {
                  digitalWrite (alarm,HIGH);
                  delay(5000);// loop
                  digitalWrite (alarm,LOW);
                  Serial.println(" voltajeLiPo:LOW" );// to smartphone
                  }

                  //
                  // Forward planes
                  //
                  TPP.writeMicroseconds(pos_tpp);
                  Serial.print("TPP= ");
                  Serial.println(pos_tpp);
                  //
                  // Rolling Pump
                  //
                  Peristaltic.writeMicroseconds(bombear);
                  Serial.print("RPump= ");
                  Serial.println(bombear);
                  //
                  // Multiswitch Robbe 12+2
                  //
                  int pulsenum = 0; // array slot zero is sync 1 thru 9 are valid pulses
                  for (pulsenum = 1; pulsenum < 9; pulsenum++)
                  {
                  Serial.print(pulsenum);
                  Serial.print("/");
                  Serial.print(multi_switch[pulsenum]);
                  Serial.print(" ");
                  }
                  Serial.println();
                  delay(500);

                  Radar.writeMicroseconds(multi_switch[1]); // Radar

                  Sonar.writeMicroseconds(multi_switch[2]); // Sonar

                  if ((multi_switch[3] <1200) && (multi_switch[3] > 0)) // Leds 1
                  {
                  digitalWrite(luces1, HIGH);
                  }
                  if (multi_switch[3] >1200)
                  {
                  digitalWrite(luces1, LOW);
                  }

                  if ((multi_switch[4] <1200) && (multi_switch[4] > 0)) // Leds 2
                  {
                  digitalWrite(luces2, HIGH);
                  }
                  if (multi_switch[4] >1200)
                  {
                  digitalWrite(luces2, LOW);
                  }

                  if ((multi_switch[5] < 1200) && (multi_switch[5] > 0))// up periscope
                  {
                  Periscopio.writeMicroseconds(2000);
                  }
                  if (multi_switch[5] > 1800) // down periscope
                  {
                  Periscopio.writeMicroseconds(1000);
                  }
                  if ((multi_switch[5] > 1400) && (multi_switch[5] < 1600)) //stop periscope
                  {
                  Periscopio.writeMicroseconds(1500);
                  }

                  if ((multi_switch[6] < 1200) && (multi_switch[6] > 0)) // retractable forward planes servo, extract
                  {
                  TPP.writeMicroseconds(1300); //exact angle to retract
                  for(pos = 1200; pos <= 2150; pos += 1)
                  {
                  Desplegar.writeMicroseconds(pos);
                  delay(15);
                  }
                  }
                  if (multi_switch[6] > 1800) // insert
                  {
                  TPP.writeMicroseconds(1300); //exact angle to retract
                  for(pos = 2150; pos >= 1200; pos -= 1)
                  {
                  Desplegar.writeMicroseconds(pos);
                  delay(15);
                  }
                  }

                  if ((multi_switch[7] <= 1200) && (multi_switch[7] > 0)) // reverse running
                  {
                  digitalWrite(inversor, HIGH);
                  }
                  if (multi_switch[7] > 1200)
                  {
                  digitalWrite(inversor, LOW);
                  }

                  if ((multi_switch[8] <1200) && (multi_switch[8] > 0)) // fire torpedo
                  {
                  digitalWrite(T_los, HIGH);
                  delay(1000);
                  digitalWrite(T_los, LOW);
                  }
                  if (multi_switch[8] >1200)
                  {
                  digitalWrite(T_los, LOW);
                  }
                  }

                  void calcPulseCh7() // Multiswitch
                  {
                  if (digitalRead(Ch7) == HIGH)
                  {
                  ulPulseStartCh7 = micros();
                  }
                  else
                  {
                  ulPulseInSharedCh7 = (uint16_t)(micros() - ulPulseStartCh7);
                  current_switch++;

                  if (ulPulseInSharedCh7 < 1000)
                  {
                  current_switch = 0;
                  }

                  if (ulPulseInSharedCh7 > 2000)
                  {
                  current_switch = 0;
                  }

                  if (current_switch < 9)
                  {
                  multi_switch[current_switch] = ulPulseInSharedCh7;
                  }
                  }
                  }

                  void calcPulseCh5() // forward planes
                  {
                  if (digitalRead(Ch5) == HIGH)
                  {
                  ulPulseStartCh5 = micros();
                  }
                  else
                  {
                  ulPulseInSharedCh5 = (uint16_t)(micros() - ulPulseStartCh5);
                  pos_tpp = ulPulseInSharedCh5;
                  }
                  }

                  void calcPulseCh2() // Rolling pump
                  {
                  if (digitalRead(Ch2) == HIGH)
                  {
                  ulPulseStartCh2 = micros();
                  }
                  else
                  {
                  ulPulseInSharedCh2 = (uint16_t)(micros() - ulPulseStartCh2);
                  bombear = ulPulseInSharedCh2;
                  }
                  }

                  Comment

                  • tsenecal

                    #39
                    Pedro,

                    the following block of code is still not good...

                    //
                    // Failsafes
                    // Lost signal radio on Deep.
                    //
                    signalRC = pulseIn(Ch2, HIGH);
                    Serial.print("signalRC= ");
                    Serial.println(signalRC);
                    sumergido = digitalRead(estado_S_I);


                    the pulseIn api call is a blocking call, which means if you do have a valid connection between the arduino and the receiver, this call is going to take somewhere between 1000 and 2000 microseconds before it comes back.

                    since Ch2 is also one of the channels that you have attached an interrupt to:

                    PCintPort::attachInterrupt(Ch2, calcPulseCh2, CHANGE);

                    you can create another volatile long integer, with a name like "deadtime", which you set to millis() inside of calcPulseCh2.

                    then inside the loop function, you can compare "deadtime" with millis(), and if the difference between millis() and "deadtime" is greater than 3000 milliseconds, then you know its been 3 seconds since you got a valid interrupt on that channel... ie, you need to drop into your failsafe routines.

                    Comment

                    • pedro gomez
                      • Sep 2007
                      • 91

                      #40
                      Tim:

                      like this:

                      void calcPulseCh2() // peristaltica
                      {
                      if (digitalRead(Ch2) == HIGH)
                      {
                      ulPulseStartCh2 = micros();
                      deadtime = millis();
                      }
                      else
                      {
                      ulPulseInSharedCh2 = (uint16_t)(micros() - ulPulseStartCh2);
                      bombear = ulPulseInSharedCh2;
                      }
                      }

                      and then....

                      void loop()

                      if ((millis() - deadtime) > 3000 )
                      {
                      Serial.print("Perdida de seƱal de radio");
                      }

                      .......
                      I add pulseIn because I noticed that when you turn off the radio, the values read of multiswitch and Ch2 and Ch5 not going to zero, so it is not useful to me to declare the failure of radio signal.
                      It would be interesting to put the voidcalc read values to 1500, so that with a loss of radio signal, all functions were to off switch value or stick in the center .

                      Tomorrow I'll apply the sketch modification as above. I will tell you.

                      Comment

                      • tsenecal

                        #41
                        Pedro,

                        I agree with what you have done for the addition of the failsafe "deadtime" variable.

                        however, upon second glance, i saw something that might cause problems.

                        the loop function should have both of these lines, and not their calc read functions.

                        bombear = ulPulseInSharedCh2;
                        pos_tpp = ulPulseInSharedCh5;

                        because the possibility exists that the loop function could be reading the bombear or pos_tpp variable at the time the interrupt is writing to that variable.

                        or better yet, there really is no reason to have both the bombear & ulPulseInSharedCh2 (and pos_tpp/ulPulseInSharedCh5) variables. keep one, and lose the other, but just make sure whichever one you keep is a "volatile" variable.

                        in the other instance, "calcPulseCh7", all of its internal variables (multi_switch, current_switch, ulPulseInSharedCh7, ulPulseStartCh7) are all listed as volatile, and all 4 variables are actually needed.

                        Comment

                        • pedro gomez
                          • Sep 2007
                          • 91

                          #42
                          Hi Tim.
                          Just now I've tested the modification as you was agree, and it runs. I'm very happy!!!!!!!!!!!
                          Well, about your reccommendations, bombear and pos_tpp only serve to have a most simple identification of the variables in the loop. Only is a rename .
                          I just now tested both functions, separately and joints, and by the moment no problem. Both bombear and pos_tpp are defined as int, and ulPulseInSharedCh5 and ulPulseInSharedCh2 are defined as volatile unsigned long.
                          I've incorporated your recommendation in the sketch and it runs equal. I save it with.
                          I dont understand your last recommendation. yes, 4 variables are volatile.

                          If you would make some modifications or improvements in the sketch, easily I can load and test it.
                          Also if someone are interested in know what is the " Marlin's hardware", I can post pictures and explanations about.
                          Also if someone has ideas (easy ideas) to improve the program, or the sketch, easily It's possible verify and test the improvement.

                          For the next weeks, I'll improve the Ictineo-II code. Now it has Two UNO and I'll use a MEGA to simplify.

                          The Code changes are:

                          lines eliminated:

                          int pos_tpp; // variable para el servo TPP.
                          int bombear; // variable para el Duoswitch.
                          int signalRC;


                          This part remains as here:
                          //
                          // Failsafes
                          // Perdida de signal de radio en inmersion.
                          //
                          sumergido = digitalRead(estado_S_I);
                          if (((millis() - deadtime) > 3000 ) && (sumergido == HIGH))
                          {
                          Serial.println("Perdida de seƱal de radio");
                          Peristaltic.writeMicroseconds(1088);
                          delay(2000);// duracion del suceso en el bucle de 2000 ms hasta incumplir condicion
                          Peristaltic.writeMicroseconds(1088);//
                          }

                          and this:

                          //
                          // Maniobra TPP
                          //
                          TPP.writeMicroseconds(ulPulseInSharedCh5);
                          Serial.print("TPP= ");
                          Serial.println(ulPulseInSharedCh5);
                          //
                          // Maniobra Rolling Pump
                          //
                          Peristaltic.writeMicroseconds(ulPulseInSharedCh2);
                          Serial.print("RPump= ");
                          Serial.println(ulPulseInSharedCh2);

                          and...

                          void calcPulseCh5() // TPP
                          {
                          if (digitalRead(Ch5) == HIGH)
                          {
                          ulPulseStartCh5 = micros();
                          }
                          else
                          {
                          ulPulseInSharedCh5 = (uint16_t)(micros() - ulPulseStartCh5);
                          }
                          }

                          void calcPulseCh2() // peristaltica
                          {
                          if (digitalRead(Ch2) == HIGH)
                          {
                          ulPulseStartCh2 = micros();
                          deadtime = millis();
                          }
                          else
                          {
                          ulPulseInSharedCh2 = (uint16_t)(micros() - ulPulseStartCh2);
                          }

                          Comment

                          • pedro gomez
                            • Sep 2007
                            • 91

                            #43
                            Hi Tim:
                            I'm trying to use PinChangeInt in a MEGA, and it don't read the values.
                            I've read in internet PinChangeInt can works with MEGA but I did a lot of test and It can't read the pulses.
                            You know solution for this?
                            Best Regards
                            Pedro

                            Comment

                            • tsenecal

                              #44
                              Pedro,

                              which pin on the MEGA are you using to connect to the receiver?

                              Tim

                              Comment

                              • tsenecal

                                #45
                                Pedro,

                                a quick look on the internet states the following "limitations" to using pinchangeint with the MEGA:

                                available pins for use:
                                PCINT 0-23 and INT 0-7

                                which means you should very easily be able to use pins A8-A15, as well as PWM pins 10-13, PWM pin 6, and PWM pins 2 & 3 with no issues. the other interrupt pins are used for serial ports and other communications, so i would try not to use them.

                                it also states that you need to be using version 1.81 or newer of the library to have support for the MEGA.

                                see http://playground.arduino.cc/Main/PinChangeInt for more info. my quick and dirty answer is: download the latest version of the library, and try the pins i listed. let me know how that works.

                                Comment

                                Working...