Arduino Uno: rectangular signal during other tasks

Hello,

I'm new on Arduino and I have some questions. For controlling of a sensor I have to generate a rectangular signal of 2Hz (5V; 50% DC) and the signal has to be given to the sensor constantly while Arduino is doing other tasks like reading and saving sensor data.
I would like to know how to solve this issue. Do I need an external hardware (e.g. oscillator)? Is it possible to do it by coding?

Regards and thank you very much for the support
BeDa

That's just blink without delay with a time of 250ms.

In the IDE go to File > Examples > 2.Digital

In the IDE go to File > Examples > 2.Digital

Or see my
http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html
Or Robin2's several things at once
http://forum.arduino.cc/index.php?topic=223286.0

Hello,

thank you very much for the feedback. I'm also interested in hardware solutions. What are good options from your point of view (e .g. timer)?

Regards BeDa

BeDa:
I'm also interested in hardware solutions.

How about a 555?

I'm also interested in hardware solutions.

Does the reading of this mystery sensor have to be synchronised to this square wave?

Why use hardware when it can be done for so little in software?

Hello,

the sensor is no mystery ..., it is an NDIR-sensor (CO2). I would like to control the bulb of the sensor with a MOSFET and take the rectangular signal for the gate. I plan to do this independently from the measurement.

Regards
BeDa

the sensor is no mystery

Yes it is because you still have not told us what sensor you have. Now we know the type of sensor but have no idea what NDIR-sensor you have.
You know because it is your sensor, we do not know stuff simply because you know stuff.

I plan to do this independently from the measurement.

So you are happy to take a measurement with the IR source off?

Hello,

sorry for the missing details and the missunderstandings. It is an Alphasense IRC-AT-sensor and the analog frontend is LMP91051. The MOSFET, the LMP91051 and the sensor reading should be controlled by the Arduino Uno. The wording "independently" means, I start the light source of the sensor with the rectangular signal and it is not interfered by any other operations of the Arduino like calculations and sending data. There is no synchronisation needed.

Regards and thank you very much for your support
BeDa

The MOSFET, the LMP91051 and the sensor reading should be controlled by the Arduino Uno.

Look it is no good trying to pull rabbits out of a hat. You know what you have but we have no idea. So please post a schematic and links to your sensors.

There is no synchronisation needed.

So I repeat you are happy to take a measurement with the IR source off?