A potentiometer (or ‘variable resistor’) has a spindle that can be moved to change the resistance value of the potentiometer. This can be used to measure rotational or linear movement.
An appropriate value for a PICAXE system is 10k (do not use 100k devices).
Potentiometer
Schematic
PCB
Read a potentiometer
This program will read a potentiometer (wiper connected to analogue input pin C.0, the ends of the potentiometer resistor between V+ and 0V) and report the value read in the 'b1' variable.
- Code Example:
-
main: readadc C.0, b1 ; Read the potentiometer value debug ; Display the value pause 1000 ; Wait a while goto main ; Repeat
Copy Code Submit an Example
Create Module
A potentiometer may be connected to the generic terminal block create module.
Bill of Materials
Description | Code | Qty | |
---|---|---|---|
1k linear potentiometer | RES020 | 1 | Buy Now |
10k linear potentiometer | RES021 | 1 | Buy Now |
Simulation
Submit Your Own Code!
You must be logged in to submit code examples. Login now.
Share