Sqare pulse Generator with specific amplitude and pulse width

Hi guys, I have an Arduino MEGA 2560 with me. I am given a task to generate certain number of pulses for a minute(60 seconds), it should have the same pulse width per pulse and also must have an amplitude of +5V.
I would appreciate if someone could tell me how this needs to be done, coding idea or even the code as well so I can later analyze and try on my own too to learn :slight_smile:

Thank you!

You could use tone( ) notone( )

The Arduino produces 0 to 5v.

The arduino can produce PWM ON PWM pins.

Look at analogWrite( )

The Blink example code is a useful place to start. The LED displays the individual pulses.

What is the 'certain number'? Small numbers are easy. Very large numbers are harder.

And what is that width? Relatively wide pulses are easy. Very narrow pulses are harder.

OK, how was this task given to you?

Can you cut and paste the details you were given here?

Like if it was an assignment in school, just copy what the teacher wrote and paste it here.

a7

Hi Naren,

welcome to the Arduino-Forum.
You can ask hundreds of questions here and they will get all answered if you fullfil some conditions:

Some weeks ago I answered to a user who was asking for very global help combined with no own effort. It took about 40 postings to make this other user understand: As soon as you starts to show some own effort and ask a specific questions you will get support.

Your question in post #1 is not specific enough. In truth you are asking

Can somebody write the full code that does this....
This is wayyyy tooo less own effort.

The minimum you can do is:

  • use google read a little bit in a demo-code you found
  • post the demo-code and ask a specific question related to this democode

https://www.google.com/search?as_q=arduino+pwm+generation

best regards Stefan

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.