Tool Writes Your PWM Code for You

The good thing about computers is they do your work for you, right? If you are a programmer, that doesn’t always seem to be a true statement. [Runtimemicro] has the answer, at least if you are writing PWM code for the Arduino. Their free application lets you set a few parameters, visually see the results, and then generates code for you. You can see a video of the tool in operation, below.

According to their site, the tool works for timers 1 through 5 on an Arduino Nano, Uno, or Mega2560. The app appears to work on Windows, but it doesn’t look like it would have any trouble running under Wine on other platforms.

There are only a few inputs: the clock speed, which timer you want to use, and the mode. You also have to specify the frequency in Hz or the period in milliseconds. You can also select a few options, including if you want interrupt code generated.

Once the timer shows up in the graphical display, you can adjust some sliders to get the exact PWM duty cycle you want. Of course, you can also skip the PWM code and just use the timer interrupts for timing.

It isn’t that the timer code or PWM isn’t workable without a tool. But then again, you don’t really need an assembler or a compiler — it just makes things easier. There are a few nuances, though. If you want to dig through the generated code, you might find [Jack’s] video interesting.

[original story: Hack a Day]

Hack a Day 06 Feb 19:30