Problem on running both timer interrupt and hardware interrupt simultaneously

Hi friends,
I'm trying to use both timer & hardware interrupt on the same time with the following code but the timer interrupt is not running while running together. but separately both are working. please help me to solve this issue.

CODE:-
#include <TimerOne.h>
const byte interruptPin = 2;
volatile int value = LOW;
void setup()
{
Serial.begin(9600);
pinMode (interruptPin, INPUT_PULLUP);
attachInterrupt (digitalPinToInterrupt(interruptPin), isr_hardware_interrupt, CHANGE);
Timer1.initialize(5000000); // in microseconds (1000000*t second)
Timer1.attachInterrupt (isr_timer_interrupt);
}
void isr_hardware_interrupt()
{
value =!value;
}
void isr_timer_interrupt()
{
Serial.println("timer interrupt called, code execution finished");
}
void loop()
{
if(value == LOW)
{Serial.println("main loop executing");
}
else
{Serial.println("hardware interrupt called");
}
}

please help me to solve this issue.

By looking at a picture? Get real. Post you code AS TEXT!

When we get to see your program code as text I strongly suspect that we will find that your Interrupt Service Routine takes too long to complete.

...R

Paul is right, please follow rules for asking questions, you can find them in topics.
About your problem, I asked simular thing and you can find it solved at the link bellow. I would strongly recommend to you to lear about timer interrupt first and not to use some libraries that you dont undrestand. If you cant solve it after reading this topic, I will send you my full code.

https://forum.arduino.cc/index.php?topic=601589.new

void isr_timer_interrupt()
{
Serial.println("timer interrupt called, code execution finished");
}

Don't do this.
Printing depends on interrupts, which are turned off in an interrupt routine.

ognjen3:
Paul is right, please follow rules for asking questions, you can find them in topics.
About your problem, I asked simular thing and you can find it solved at the link bellow. I would strongly recommend to you to lear about timer interrupt first and not to use some libraries that you dont undrestand. If you cant solve it after reading this topic, I will send you my full code.

External and Timer Interrup - Programming Questions - Arduino Forum

Thanks. Please share with me your detailed code. I have gone through the post you referred but I'm not able to understand the details of the procedure of solving.
Is it not possible through using TimerOne library & hardware interrupt on the same time or by using of any other library. It would be more helpful for me.

jremington:

void isr_timer_interrupt()

{
Serial.println("timer interrupt called, code execution finished");
}



Don't do this.
Printing depends on interrupts, which are turned off in an interrupt routine.

Hi, If despite of doing printing operation am going to run some specific digitalwrite, then should it be workable??

Is it not possible through using TimerOne library & hardware interrupt on the same time or by using of any other library.

There is no issue with using the TimerOne Library and external interrupts in the same sketch.

Thanks all

I think this way is better because I directly cumunicate with registers so in every step I know what is written in them. Im at work right now, so tonight I will send you my code with comments so you can understand it, ans most of all, you will lear how time interrupt work.
When I use TimeOne lib, I dont know whats happening in background so Im not fan of it, but yes you can use it.