I just discovered the joys of Arduino PWM (pulse width modulation). Easy on my Nano, except for 1 GPIO pin is's a nasty kludge on the Pi. Ha! (I listed USB-connected source code for Pi and Arduino back in Post 66.)
BTW: PWM is useful for things like dimming LEDs. In my case, I wanted a user to notice differences in output of mini-motor vibrators (e.g., from Adafruit). You have 256 output levels: 0=none(OFF), 127=half, 255=full(ON).
P.S.: While Pi prices are pretty standardized, Arduino prices are all over the place. I've noted Internet-listed Nanos (my favorite model) at anywhere from over $30 down to $3.30 (no cable, soldering required, delivery from China).