The Arduino has an 8 bit PWM built-in, which means it has up to 256 levels of control. ( 2^8 = 256 ).
These 256 levels of control actually determines the percentage of the ON duty cycle over the OFF.
0 is completely OFF while 255 is completely ON.
In this article, I’m using a Visual Basic program to control the PWM on the Arduino.
PWM can control many things, such as LED, motors, sound amplitude, etc.
If you wish to control a motor, you’ll need a transistor as shown below.
The Visual Basic and Arduino source code can be downloaded below but make sure you change the code highlighted below to the correct COM port.