Tag

typedef

Browsing

The Arduino Uno has six pins dedicated to Pulse Width Modulation (PWM). PWM is great for analog-like control for the speed of motors or LED fading. But what if you want to control more than 6 devices? Or what if you’re using the PWM pins to control servo motors, but still want to fade an LED on a 7th pin?

One option is to change boards and processors. For example, you could move up to the Arduino Mega 2560. That means a bigger board and more cost.

Using millis() and micros(), it is possible to do PWM entirely in software. The best part is; if you can set the pin to OUTPUT, you can use this technique.

This tutorial will explain how you can use micros() and millis() to get more PWM pins on an Arduino Uno, Nano, or Pro Mini. It will probably work on other boards and processor types, but I haven’t tested them yet.

There’s a reason I needed this software PWM code. Subscribe to the mailing list, RSS feed, or follow me on social media to see why next week…

Apologies to the email subscribers if the code isn’t formatted correctly. Click here to read the full post.