hi everyone,
i have been useing nano and uno for long time, but their pins and storages not enought for last project.
So i was moved to mega2560.
my trouble; attachInterrupt(0, say, RISING); command works good on arduino nano,
but not working correctly on mega.
normally(rally normal on nano) ;RISING to trigger when the pin goes from low to high.
when the pin voltage 0 to 2,4 , interrupt function called only one time and sayi increase +1
if pin voltage is 5 to 0 , no chance anything.
but the same codes upload to mega2560
when the pin voltage is between 1,5 - 2,4 ,interrupt function is looping and "sayi" increasing limitless .
i need rising or falling function four interrupt pins.
Regards...
unsigned long delays=0;
int sayi=0, voltage=0;
bool durum=false;
void setup() {
// pinMode(2 ,INPUT_PULLUP);
attachInterrupt(0, say, RISING);
Serial.begin(9600);
}
void say() { sayi++; durum=true;}
void loop() {
if ((millis()-delays)>=50)
{
delays=millis();
Serial.print("durum=");
Serial.print(durum);
Serial.print(" ");
Serial.print(sayi);
Serial.print(" ");
if (durum)
{
durum=false;
}
voltage=analogRead(A0);
voltage=map(voltage,0,1023,0,5000);
Serial.println(voltage);
}
}
thats on nano, shows (durum,sayi,voltage) on serial monitor






