help me tutorial overlap interrupt

// my code it not overlap //switch1 "SW1" for interrupt "in1" //switch2 "SW2" for interrupt "in2" //Tutorial me for overlap interrupt "in1" to "in2"

int LED1=5; int LED2=6; int LED3=7; int SW1=2; int SW2=3;

void setup() { Serial.begin(9600); pinMode(LED1,OUTPUT); pinMode(LED2,OUTPUT); pinMode(LED3,OUTPUT); attachInterrupt(digitalPinToInterrupt(SW1),in1,LOW); attachInterrupt(digitalPinToInterrupt(SW2),in2,CHANGE); }

void loop() { digitalWrite(LED3,HIGH); delay(50); digitalWrite(LED3,LOW); delay(50); }

void in1() { digitalWrite(LED2,HIGH); delay(1000000); digitalWrite(LED2,LOW); delay(10000); }

void in2() { digitalWrite(LED1,HIGH); delay(1000000); digitalWrite(LED1,LOW); delay(10000); }

I don't know what you are trying to do, but a 1000000 millisecond delay(), or any delay() for that matter, is not how to use interrupts. In fact, when using interrupts, delay() anywhere in the program is not a good idea because interrupts are disabled within an ISR and delay() uses them.

What is it that you are trying to do ? Why do you think that you need to use interrupts ?

You will need to provide a lot more information about what you are trying to achieve. Start by providing a full description of your project.

…R

PS… please modify your post and use the code button </>

so your code looks like this

and is easy to copy to a text editor. See How to use the Forum

UKHeliBob: I don't know what you are trying to do, but a 1000000 millisecond delay(), or any delay() for that matter, is not how to use interrupts. In fact, when using interrupts, delay() anywhere in the program is not a good idea because interrupts are disabled within an ISR and delay() uses them.

What is it that you are trying to do ? Why do you think that you need to use interrupts ?

in session interrupt 1000000 not millisecond ,my experimental 1000000= 5 second, tell me for overlap interupt , please

Robin2:
You will need to provide a lot more information about what you are trying to achieve. Start by providing a full description of your project.

…R

PS… please modify your post and use the code button </>

so your code looks like this

and is easy to copy to a text editor. See How to use the Forum

i experimental trying interrupt 2 way or more,

Read the information provided in attachInterrupt() and then reconsider your question.

arduarn: Read the information provided in attachInterrupt() and then reconsider your question.

this is single pin for interrupt , yes i'm understand your attached, but i'm need pin 2 and 3 to interrupt(2 way for interrupt), tell me for Overlap Interrupt please....

Thai100: this is single pin for interrupt , yes i'm understand your attached, but i'm need pin 2 and 3 to interrupt(2 way for interrupt), tell me for Overlap Interrupt please....

You need to read, learn and understand how to use interrupts before getting all complicated. Putting delay(1000000), which is theoretically a 1000 second delay, in your interrupt handlers tells us that you have no idea what you are doing.

UKHeliBob: What is it that you are trying to do ? Why do you think that you need to use interrupts ?

How about answering these questions?

arduarn: You need to read, learn and understand how to use interrupts before getting all complicated. Putting delay(1000000), which is theoretically a 1000 second delay, in your interrupt handlers tells us that you have no idea what you are doing. How about answering these questions?

yes i'm answer delay(10000000) = delay 5 seconds, // """""delay 1000000 it run in interrupt session""""" can you test by my code, """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

what are you doing??? answer : i need to interrupt 2way , overlap pin1 and pin2

What do you mean by 2way?

i need to interrupt 2way , overlap pin1 and pin2

Do you mean that you need the program to respond to either interrupt 0 or interrupt 1 ?

Why do you think you need to use interrupts ?

UKHeliBob:
Do you mean that you need the program to respond to either interrupt 0 or interrupt 1 ?

Why do you think you need to use interrupts ?

interrupt 0 = pin(2)
interrupt 1 = pin(3)

“”""""""""""""""""""""""""""""""""""
from my code ,
if interrupt 0 activate interrupt 1 be not work,
if interrupt 1 activate interrupt 0 be not work,
it can’t interrupt overlap

“”"""""""""""""""""""""""""""""""""""

/////////////////((((i need)))))\\\\\\\\\
if interrupt 1 activate interrupt 0 ready to overlap ,
if interrupt 0 activate interrupt 1 ready to activate overlap,

tell me please : arduino able to do?
you understand me?
i’m sorry for bad english language (T___T)
/////////////////////////\\\\\\\\\\\\\

Thai100:
from my code ,
if interrupt 0 activate interrupt 1 be not work,
if interrupt 1 activate interrupt 0 be not work,

I can’t figure from you very short descriptions whether you want the two LEDs to be on at the same time or whether you want to ensure that only one is on at any one time.

In either case the way you are trying to do it is completely wrong. Any code that is called as a result of an interrupt should complete within a fraction of a millisecond.

If you want two (or more) LEDs to operate independently look at how it is done in Several Things at a Time

In Reply #2 I asked you to describe your project. If you do so you will get advice that is much more useful. If you are doing things that are timed in seconds there is almost certainly no need to use any interrupts.

…R

Let's try it differently.

You have three leds. Led3 blinks constantly, led1 blinks when a change in SW2 is detected and led2 blinks when SW1 is low.

As that what you need to achieve?

if interrupt 0 activate interrupt 1 be not work, if interrupt 1 activate interrupt 0 be not work,

Even if what you want to do, whatever that is, is possible it is not going to work using interrupts. Interrupts are automatically disabled when servicing an interrupt. Can you see why your idea will not (cannot) work ?

Tell us what you want to do rather than how you imagine it can be done.

Robin2:
I can’t figure from you very short descriptions whether you want the two LEDs to be on at the same time or whether you want to ensure that only one is on at any one time.

In either case the way you are trying to do it is completely wrong. Any code that is called as a result of an interrupt should complete within a fraction of a millisecond.

If you want two (or more) LEDs to operate independently look at how it is done in Several Things at a Time

In Reply #2 I asked you to describe your project. If you do so you will get advice that is much more useful. If you are doing things that are timed in seconds there is almost certainly no need to use any interrupts.

…R

thank for your interest to help me , i’m not want add LED,
i want to know , How to Interrupt Overlap,


i want to use interrupt0 and interrupt1
but my code can’t to do this
**

how to cancel command interrupt 0 while interrupt 0 activate<<<<<<<<<<<<<<<<<<<<
how to cancel interrupt 0 and activate interrupt 1<<<<<<<<<<<<<<<<<<<<<<<<<<
when interrupt 0 activate i want blink to interrupt 1<<<<<<<<<<<<<<<<<<<<<<<<<


thank for trying to help me
thank everybody
thank again

sterretje: Let's try it differently.

You have three leds. Led3 blinks constantly, led1 blinks when a change in SW2 is detected and led2 blinks when SW1 is low.

As that what you need to achieve?

thank for your understand me (^____^);

********************now i want to achieve****************** 1.delay in my interrupt is "delay(1000000)" = it is 5 seconds 2.when push switch(SW1) will go to interrupt(in1) 3.interrupt(in1) activate on LED2 5 seconds 4.while interrupt(in1) run 2 or 3 seconds , i want push switch(SW2) to toggle interrupt(in2) activate

***********now i'm not achieve section 4*********************

(^^)guide me please(^^)

Thai100: thank for your interest to help me , i'm not want add LED, i want to know , How to Interrupt Overlap,

I don't know if the problem is that you don't understand what I write because English is not your first language.

If you DO understand what I write then you seem to be deliberately ignoring what I (and others) say so that it seems I am just wasting my time.

I will not help any further until you provide a good description of your project so that I can understand the context of your questions. I have already asked for that in Replies #2 and #12. And if it is a secret project I have no interest in helping.

...R

UKHeliBob: Even if what you want to do, whatever that is, is possible it is not going to work using interrupts. Interrupts are automatically disabled when servicing an interrupt. Can you see why your idea will not (cannot) work ?

Tell us what you want to do rather than how you imagine it can be done.

thank for your reply, it very helpful for me,

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

for automatically disabled when servicing an interrupt, Guide me for enable interrupt overlap, Pleaseeeee (^___^)

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Guide me for enable interrupt overlap,

Why do you need to use interrupts ?

Do you want to activate an LED sequence when a button is pressed and change to another one when a second button is pressed ? If not, then please describe what you want to do.

Like Robin, I will not reply again until you explain what you are trying to do.