A Resistor-capacitor circuit (R-C Circuit) is a useful way to read a changing resistance when your microcontroller has no analog input pins.

In PicBasic Pro and many other microcontroller BASICs, there is a command called RCTIME that reads this circuit. It works like this:

First, you take the RC input pin high to discharge the capacitor (it's getting a charge from the input voltage). Then wait a few microseconds to let it debounce. Then use the RCTIME command to read the number of microseconds for the capacitor to charge.

The amount of time it takes for the capacitor to charge will depend on the size of the capacitor and the resistance of the variable resistor. Since the capacitor size is fixed, the varying number of microseconds that it takes for RCTIME to finish will vary with the resistance of the variable resistor.

You can also measure a changing capacitance by using a variable capacitor and a fixed resistor.