You may not think of salt and sugar as solids because when you see them in the kitchen they are such small particles. But each of these particles is as much a solid as a wooden table, a glass window, or a gold piece of jewelry. A solid is a collection of atoms or molecules that are held together so that, under constant conditions, they maintain a defined shape and size.
Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off.
The Gist. PWM works by varying the width of the on signal (read Duty Cycle) within a fixed signal frequency or period of time. So what we are really looking for is the length of time the signal remains high for each cycle. There are several ways to do this. The easiest is using the pulseIn function as shown below.