Library PinChangeInt dont' work

Recently, when trying to use``Use code tags to format code for the forum a sketch that I have been using for 10 years without problems, with the PinChangeInt library, to read the channels of an RC receiver, it has stopped working, don't read, and it seems that the setup is restarted, and the void is not executed loop.

#include <PinChangeInt.h>
#define Ch3 A10 
volatile unsigned long ulPulseInSharedCh3 = 0;
volatile unsigned long ulPulseStartCh3 = 0;
volatile unsigned long deadtime ;
void setup() 
{
Serial.begin(9600);
PCintPort::attachInterrupt(Ch3, calcPulseCh3, CHANGE); 
}
void loop()
{
Serial.println("hola");
Serial.print("ch3:");Serial.println(ulPulseInSharedCh3);
}
void calcPulseCh3() // Motor
{
if (digitalRead(Ch3) == HIGH)
    {
    ulPulseStartCh3 = micros();
    }
else
    {
    ulPulseInSharedCh3 = (uint16_t)(micros() - ulPulseStartCh3);
    }
}

Did you start the topic in the Command line tools topic of the forum on purpose or was it a mistake ?

Which Arduino board are you using ?

It is a MEGA

I don't know....i'm a learner in this forum

Yes, I need help

Are you using the CLI tools or the IDE to program the Mega ?

The IDE, 1.8.19. Although I have also tried 2.3.2, without this solving the problem.

Your topic has been moved to the Programming Questions category of the forum

Ok, I follow it there.

No need to follow it. You just posted in it in its new location

  • Place a Serial Print in setup ( ) to see if the Arduino is indeed restarting.
  • Always show us a good schematic of your proposed circuit. Show us good images of your ‘actual’ wiring. Give links to components.
  • Check your voltages under load.

Answer::::

Place a Serial Print in setup ( ) to see if the Arduino is indeed restarting.:

Yes I did. It restart. In IDE only appears the voidsetup serialprint

Always show us a good schematic of your proposed circuit. Show us **good images of your ‘actual’ wiring. Give links to components:

Is very easy Only two wires: Channel 3, pin Ch3, of the receiver to pin A10 in Arduino MEGA, and Ground Receiver pin, to GND pin in Arduino MEGA.
Trasmitter FUTABA FC-18 and Receiver FUTABA DUalConversion FP-R128DF

Check your voltages under load:

MEGA with 5A powersource OR/AND USB cable , and Receiver with 5 A regulator. Voltages are perfect under load.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.