Hi,
My question is how come atmega328P can print the statement which is in setup() more than one time ?
Here i will attach two codes in which i have enable both external interrupts.When there is signal come at external interrupt 1 it should increment my variable which is in ISR and print the value of that variable. But what is happening ,when ever signal come on the pin it prints the message again and again which i have written in setup().How? and WHY?
I know that use of Serial.println() in ISR is not appropriate but i am just using for debugging purpose it will not be present in my final design.And i have also tried with move that Serial.println() in loop() but still facing same issue.
There is also one other program(working code) in which i have use same logic to print the same variable it works fine in that code.Then how come the same logic is not acceptable for my nonworking code?
Did i miss something which i dont even aware of even after working on arduino since almost 1year.
You missed the how-to-use-this-forum part where it says to use code tags to show your code.
I won't click on your .ino files because that will open my Arduino IDE that will want to save them in projects folder, and I don't want to get through the chore of deleting other's people folders.,ino files from my project directory just because you didn't care to read the forum how-to and follow the advice there that states: " use code tags "
Hi,
My question is how come atmega328P can print the statement which is in setup() more than one time ?
Here i will attach two codes in which i have enable both external interrupts.When there is signal come at external interrupt 1 it should increment my variable which is in ISR and print the value of that variable. But what is happening ,when ever signal come on the pin it prints the message again and again which i have written in setup().How? and WHY?
I know that use of Serial.println() in ISR is not appropriate but i am just using for debugging purpose it will not be present in my final design.And i have also tried with move that Serial.println() in loop() but still facing same issue.
There is also one other program(working code) in which i have use same logic to print the same variable it works fine in that code.Then how come the same logic is not acceptable for my nonworking code?
Did i miss something which i dont even aware of even after working on arduino since almost 1year.
My question is how come atmega328P can print the statement which is in setup() more than one time ?
Clearly that happens because the Arduino is resetting, causing setup() to run again.
I know that use of Serial.println() in ISR is not appropriate but i am just using for debugging purpose it will not be present in my final design.
But it IS present in the code that is causing problems. Get rid of it, and see if the problem goes away.
i am using 1.6.5 IDE.
That version blocks if the outgoing serial buffer gets full, waiting for room. Room is made in the serial buffer by shifting data out, but that happens only when an interrupt happens, but interrupts don't happen when an interrupt service routine is running. So, if the buffer gets full, the Arduino will seem to hang.