flexitimer2

Hello everyone, I would like to create interruptions of 100ms and 3000ms. I think something does not work well in my programme. I want to generate a signal HIGH during 100ms and LOW during another 100ms. Then I want to generate another signal HIGH during 3secs and a LOW during 3secs as well.
The led 13 is blinking during 3secs and remains off during another 3secs. But the first signal does not happen (100ms). Thanks for your help.

#include <FlexiTimer2.h>

void dccInterrupt()
{
static boolean output = HIGH;
digitalWrite(LED_BUILTIN,output);
output=!output;
}

void Bitun()
{
pinMode(LED_BUILTIN, OUTPUT);
FlexiTimer2::set(100,dccInterrupt);
FlexiTimer2::start();
}

void BitZero()
{
pinMode(LED_BUILTIN, OUTPUT);
FlexiTimer2::set(3000,dccInterrupt);
FlexiTimer2::start();
}
void setup() {

pinMode(LED_BUILTIN,OUTPUT);

}

void loop() {
Bitun();
BitZero();

}

Welcome to the Forum. Please read these two posts:

General Guidance and How to use the Forum
and
Read this before posting a programming question …
It is important to provide as much of the information that is needed to solve your problem as you can, in your first posts. The forum link above has guidelines for posting in a standard way that makes it easiest for people to provide you with useful answers. Making an effort to do this will greatly increase the number and quality of helpful responses that you get.

In cases where timing is involved, words tend to not translate clearly into well defined parameters. For this reason, I strongly suggest that you make a pen and paper sketch, or a computer drawing of the lighting sequence with time in the X axis.

Also, you have posted code without using code tags. The code tags make the code look

like this

when posting source code files. It makes it easier to read, and can be copied with a single mouse click. Also, if you don’t do it, some of the character sequences in the code can be misinterpred by the forum code as italics or funny emoticons. The “Code: [Select]” feature allows someone to select the entire sketch so it can be easily copied and pasted into the IDE for testing or review.

If you have already posted without using code tags, open your message and select “modify” from the pull down menu labelled, “More”, at the lower right corner of the message. Highlight your code by selecting it (it turns blue), and then click on the “</>” icon at the upper left hand corner. Click on the “Save” button. Code tags can also be inserted manually in the forum text using the code and /code metatags.

A. Why do want to use interrupts for such slow signals? B. How do you expect a single timer to produce interrupts at both 100 and 3000 milliseconds?

It looks like you are trying to get a single output to both blink 5 times a second (100 ms ON, 100 ms OFF) and once every 6 seconds (3s ON, 3s OFF). That can't be right. What do you REALLY want to do?

best way to explain it is to draw a timing-diagram on a sheet of paper shoot a picture of it with your smartphone and then attach this picture to a posting.

here is a link with tips how to speed up getting good answers best regards Stefan