Good afternoon.
I am working with an Arduino Mega and with interrupts.
I have set up a Hardawar mintage with PULL_DOWN resistencies.
When I measure with the tester, pin 18 and 19, I measure 0V DC, which is what I expect to have. At pins 20 and 21 I measure 1.2V DC. I don't know why I have this voltage.
I am attaching the program I use and a drawing showing how I have mounted the 4K7 resistors.
Could it be that the Arduino is bad?
(pins 20 & 21 are not available to use for interrupts while they are used for I2C communication:
I am not using I2C)
Thanks.
#define INTERRUPT_Celula 18 // Celula
#define INTERRUPT_Mes1 19 // +1
#define INTERRUPT_Menys1 20 // -1
#define INTERRUPT_Reset 21 // Reset
#define BtPausa 23 // Pausa
#define BtResetTotal 25 // Reset Total
#define PinZumbador 27 // Pin Zumbador
const int timeThreshold = 150;
long startTime = 0;
volatile bool state = false;
void setup()
{
Serial.begin(9600);
// Botons i interrupcions************
pinMode(INTERRUPT_Celula, INPUT);
pinMode(INTERRUPT_Mes1, INPUT);
pinMode(INTERRUPT_Menys1, INPUT);
pinMode(INTERRUPT_Reset, INPUT);
pinMode(BtPausa, INPUT);
attachInterrupt(digitalPinToInterrupt(INTERRUPT_Celula), IntCelula, RISING);
attachInterrupt(digitalPinToInterrupt(INTERRUPT_Mes1), IntMes1, RISING);
attachInterrupt(digitalPinToInterrupt(INTERRUPT_Menys1), IntMensy1, RISING);
attachInterrupt(digitalPinToInterrupt(INTERRUPT_Reset), IntReset, RISING);
//*************************
Serial.println("Setup OK ******************");
}
void loop()
{
// put your main code here, to run repeatedly:
}
void IntCelula() //Change led state
{
Serial.println("Celula");
if (millis() - startTime > timeThreshold)
{
state = true;
startTime = millis();
}
}
void IntMes1() //Change led state
{
Serial.println("Mes 1");
if (millis() - startTime > timeThreshold)
{
state = true;
startTime = millis();
}
}
void IntMensy1() //Change led state
{
Serial.println("Menys 1");
if (millis() - startTime > timeThreshold)
{
state = true;
startTime = millis();
}
}
void IntReset() //Change led state
{
Serial.println("Reset");
if (millis() - startTime > timeThreshold)
{
state = true;
startTime = millis();
}
}